ProcessStartInfo psInfo = new ProcessStartInfo();
psInfo.FileName = @"c:\windows\system32\ipconfig.exe"; //실행파일
psInfo.UseShellExecute = false; //쉘 기능을 사용 하지 않는다.
psInfo.RedirectStandardOutput = true; //표준 출력을 리다이렉트
Process p = Process.Start(psInfo); //어플리케이션 실행
string output = p.StandardOutput.ReadToEnd(); //표준 출력 읽어 잡기
output = output.Replace("\r\r\n", "\n"); //줄바꿈 코드의 수정
OutputLog(output);
ProcessStartInfo psInfo = new ProcessStartInfo();
psInfo.FileName = @"c:\windows\system32\ipconfig.exe"; //실행파일
psInfo.CreateNoWindow = true; //윈도우를 열지 않는다.
psInfo.UseShellExecute = false; //쉘 기능을 사용 하지 않는다.
psInfo.RedirectStandardOutput = true; //표준 출력을 리다이렉트
Process p = Process.Start(psInfo); //어플리케이션 실행
string output = p.StandardOutput.ReadToEnd(); //표준 출력 읽어 잡기
output = output.Replace("\r\r\n", "\n"); //줄바꿈 코드의 수정
OutputLog(output);
ipconfig의 옵션은?
ㅎㅎㅎ
ProcessStartInfo에서 옵션을 넣기 위해선 Arguments속성을 이용합니다.
ProcessStartInfo psInfo = new ProcessStartInfo();
psInfo.FileName = @"c:\windows\system32\ipconfig.exe"; //실행파일
psInfo.Arguments = "/all"; //옵션
psInfo.CreateNoWindow = true; //윈도우를 열지 않는다.
psInfo.UseShellExecute = false; //쉘 기능을 사용 하지 않는다.
psInfo.RedirectStandardOutput = true; //표준 출력을 리다이렉트
Process p = Process.Start(psInfo); //어플리케이션 실행
string output = p.StandardOutput.ReadToEnd(); //표준 출력 읽어 잡기
output = output.Replace("\r\r\n", "\n"); //줄바꿈 코드의 수정
OutputLog(output);