开发者

How to Run a C# console app with the console hidden style? [duplicate]

开发者 https://www.devze.com 2023-03-19 09:11 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: C#: Run external console program as hidden
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

C#: Run external console program as hidden

I am using a Windows Forms application that needs to start a console app. I don't want the console app be displayed on windows task

I setting p.WindowStyle = ProcessWindowStyle.Hidden;

But it doesn't work, the process is showing

Code:

ProcessStartInfo p = new ProcessStartInfo();

p.UseShellExecute = false;
p.RedirectStandardOutput = true;
p.FileName = "rasdial";
p.Arguments = string.Format("\x22{0}\x22", name);
p.WindowStyle = ProcessWindo开发者_开发知识库wStyle.Hidden;

Process process = Process.Start(p);

Any help would be appreciated. Thanks in advance!


The solution:

p.CreateNoWindow = true;
0

精彩评论

暂无评论...
验证码 换一张
取 消