david's daily developer note

C#, Command창 명령어 실행하기. 본문

[Develop] Language/C#

C#, Command창 명령어 실행하기.

mouse-david 2010. 8. 27. 17:32
728x90
command창 명령어를 C#응용프로그램에서 바로 수행하자. ㅎㅎ

System.Diagnostics.ProcessStartInfo procStartInfo = 
new System.Diagnostics.ProcessStartInfo("cmd", "/c " + "mstsc.exe");

procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;

procStartInfo.CreateNoWindow = true; // Do not create the black window.

// Now we create a process, assign its ProcessStartInfo and start it
System.Diagnostics.Process proc = new System.Diagnostics.Process(); 
proc.StartInfo = procStartInfo;
proc.Start();
728x90