我需要问一个问题,我真的无法在互联网上找到..我正在使用进程在我的c#应用程序中打开cmd ..我需要传递一些命令,但每个命令后,我需要确保该命令完成,所以我可以继续其他的!...怎么可能与System.Diagnostics程序......这是我的代码,我试过..终端完成后,继续执行某个命令
var startInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
RedirectStandardInput = true,
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = false,
WorkingDirectory = @"E:/Visual Studio 2013/" + project_Name + "/packages/NUnit.ConsoleRunner.3.4.1/tools"
};
var process = new Process { StartInfo = startInfo };
process.Start();
process.StandardInput.WriteLine("nunit3-console.exe E:/Debug/Report_Testing.dll");
process.WaitForExit();
等待退出这里无限挂起,我无法通过这行代码。 这有什么解决方案!?
我无法理解你Uno对不起,我想知道命令什么时候结束......选项/ k有什么作用?你还希望我把它添加在writeline行? –
@ OmarEl-elamy你的过程启动'cmq',而不是nunit亚军,所以它被连接到那个终止。如果你想在你的代码中关闭它,你应该将'exit'发送到命令行,但我认为这不会很优雅。 –
测试运行器作为cmd的**子**运行,所以即使跑步者退出,父母也不会。 –