나는 3-4 버전을 시도하고 아무도 나를 위해 일했다. 나는 더 이상 소스가 없지만 그것은 잘 작동하지만, 나는 여전히 그것에서 결과 문자열을 필요로 작은 exe를 가지고캔트 프로세스에서 표준 출력을 리디렉션
Process proc = new Process();
ProcessStartInfo StartInfo = new ProcessStartInfo();
StartInfo.RedirectStandardError = true;
StartInfo.RedirectStandardOutput = true;
StartInfo.FileName = path + "calculate.exe";
StartInfo.Arguments = input;
StartInfo.UseShellExecute = false;
StartInfo.CreateNoWindow = true;
proc.StartInfo = StartInfo;
proc.Start();
proc.WaitForExit();
string output = proc.StandardOutput.ReadToEnd();
MessageBox.Show(output);
빈 메시지 박스가 생깁니다. 이유가 무엇입니까? WaitForExit에 중단 점을 추가하면 StandardOutput에서 리디렉션되지 않았거나 프로세스가 아직 시작되지 않았다고 말합니다.
젠장 자동 완성! 하지만 그래도 맞아, 난 여전히 비어있는 메시지 상자가 생겼어 .. –
코드가 업데이트되었는데 여전히 작동하지 않는다. –
@AdnanElezovic'proc.StandardError.ReadToEnd();도 시도해 봤나? 프로그램이 stderr로 출력 할 수 있습니다. – Gray