过去存在已知问题,即在使用 WaitForExit 时应用程序会冻结。
你需要使用
dim Output as String = MyProcess.StandardOutput.ReadToEnd()
打电话之前
MyProcess.WaitForExit(90000)
参考微软的片段:
// Start the child process.
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "Write500Lines.exe";
p.Start();
// Do not wait for the child process to exit before
// reading to the end of its redirected stream.
// p.WaitForExit();
// Read the output stream first and then wait.
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardoutput.aspx