[英]How to start Process hidden?
我通过ProcessStartInfo和process.Start()启动控制台应用程序。 我想隐藏黑色的窗户。 这是我的代码:
string output = "";
//Setup the Process with the ProcessStartInfo class
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "C:\\WINNT\\system32\\cmd.exe";
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
//Start the process
Process proc = Process.Start(startInfo);
最后的答案是
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = ....
psi.RedirectStandardInput = true;
psi.RedirectStandardOutput = false;
psi.Arguments =...
psi.UseShellExecute = false;
psi.CreateNoWindow = true; // <- key line
尝试这个:
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
尝试
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
Process p = new Process();
....
p.StartInfo.CreateNoWindow = true;
p.Start();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.