gpt4 book ai didi

c# - 使用参数在 C# 中运行控制台应用程序

转载 作者:太空狗 更新时间:2023-10-29 18:03:36 26 4
gpt4 key购买 nike

如何在 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();

关于c# - 使用参数在 C# 中运行控制台应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6511978/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com