[C#] 외부 응용 프로그램 실행하기

2009. 4. 9. 15:23Software Development/.NET Framework

Win32 API인 ShellExecute()와 WinExec() 같은 역할을 하는 C#의 Method가

무엇인지 알아보았습니다. Process.Start() Method를 사용하면 됩니다.

 

using System.Diagnostics;

public static Process Start (string fileName);

public static Process Start (string fileName, string arguments);

 

도스 명령어 실행

System.Diagnostics.Process.Start("cmd.exe”, “/c dir”);

특정 폴더 열기

System.Diagnostics.Process.Start(“explorer.exe”, “C:\Temp”);

윈도우 종료

System.Diagnostics.Process.Start(“cmd.exe”, “Shutdown.exe –s –f –t 00”);

윈도우 재부팅

System.Diagnostics.Process.Start(“cmd.exe”, “Shutdown.exe –r –f –t 00”);

IE 열기

System.Diagnostics.Process.Start("IExplore.exe", "www.northwindtraders.com");

출처 : http://skql.tistory.com/510