Click here to Skip to main content
15,896,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an executable file which I need to run in a C# code but the console should be hidden while it is running.

Below is the code I used to run the executable file:
----------------------------------------------------
Process process = new Process();
process.StartInfo.FileName = ".\\ABC.exe";
process.Start();
----------------------------------------------------

Request you to please suggest how this can be achieved.

What I have tried:

Process process = new Process();
process.StartInfo.FileName = ".\\ABC.exe";
process.Start();
Posted
Updated 13-Sep-17 4:00am

See here: ProcessStartInfo.CreateNoWindow Property (System.Diagnostics)[^] and read the "Remarks" section.
 
Share this answer
 
i just figured it out and would like to share the same piece of code with all:

Process process = new Process();
process.StartInfo.FileName = ".\\ABC.exe";
process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
process.Start();
 
Share this answer
 
Comments
Dave Kreskowiak 13-Sep-17 10:37am    
No thanks. I'll just read the documentation on the ProcessStartInfo class, 'cause that's where they hide this kind of basic information.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900