如何在C#中运行控制台应用程序,向其传递参数,并以Unicode获取应用程序的结果? Console.WriteLine
在控制台应用程序中使用。
重要的一点是在控制台应用程序中编写Unicode。
最佳答案
MSDN的样本
// 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();