如何启动进程隐藏? [英] How to start Process hidden?

查看:15
本文介绍了如何启动进程隐藏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过 ProcessStartInfo 和 process.Start() 启动了一个控制台应用程序.我想隐藏黑色窗口.这是我的代码:

I start a Console Application via ProcessStartInfo and process.Start(). I want to hide the black window. Here's my code:

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;//<- 关键行

这篇关于如何启动进程隐藏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆