Is there a way to hide the console window when executing a console application?
I am currently using a Windows Forms application to start a console process, but I don't want the console window to be displayed while the task is running.
If you are using the ProcessStartInfo
class you can set the window style to hidden - in the case of console (not GUI) applications, you have to set CreateNoWindow to true
:
System.Diagnostics.ProcessStartInfo start =
new System.Diagnostics.ProcessStartInfo();
start.FileName = dir + @"\Myprocesstostart.exe";
start.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; //Hides GUI
start.CreateNoWindow = true; //Hides console