流程开始不工作Cmd窗口C#

时间:2017-07-05 14:14:42

标签: c# shell cmd process command

我正在开发一个关于C#的Visual Studio 2017 Project,我尝试使用代码Process Start。但是,当我尝试它时,命令没有工作cmd窗口打开但它没有在窗口上写任何命令。我该怎么办?

private void button2_Click(object sender, EventArgs e)
{
    Process.Start("cmd", "command");
}

1 个答案:

答案 0 :(得分:0)

Process.Start("cmd", "/c command & pause");

我添加了&暂停,这样你就可以看到窗户熬夜。

如果您根本不想要显示该窗口。

ProcessStartInfo info = new ProcessStartInfo( "cmd", "/c command" );
info.CreateNoWindow = true;
info.UseShellExecute = false;
Process.Start( info );
相关问题