How to run a C# console application with the console hidden
If you wrote the console application you can make it hidden by default.
Create a new console app then then change the "Output Type" type to "Windows Application" (done in the project properties)
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
If you are using Process Class then you can write
yourprocess.StartInfo.UseShellExecute = false;
yourprocess.StartInfo.CreateNoWindow = true;
before yourprocess.start();
and process will be hidden