Click here to Skip to main content
15,888,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to run the cmd shell minimized from C# code. How can i do that?
The problem is when I try to run a command using smd (for example mounting of a drive) it opens console window maximuzed and it hides my application Form. It doesn't look good, so I want to find a way to run the cmd minimized.

My code is:

mountingProcess = new Process();
mountingProcess.StartInfo.FileName = "net.exe";
string argument = "use \\\\" + serverIP + "\\ipc$ /user:" + domain + "\\" + user + " " + password;
mountingProcess.StartInfo.Arguments = argument;
mountingProcess.Start();


Anybody have some ideas how to do it?

Thanks!
Posted
Updated 6-Apr-10 3:10am
v2

Try
mountingProcess.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
 
Share this answer
 
It works!
thanks a lot! .
 
Share this answer
 

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