Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 = ProcessWindowStyle.Hidden;

Process process = Process.Start(p);

Any help would be appreciated. Thanks in advance!

like image 905
The Mask Avatar asked Feb 24 '23 15:02

The Mask


1 Answers

The solution:

p.CreateNoWindow = true;
like image 115
The Mask Avatar answered Apr 27 '23 10:04

The Mask