Reputation: 29
Process.Start( "cmd.exe", argument1) Shows Command prompt in task manager but not open Command prompt window on windows server R2.I test it locally it runs perfect and open Command prompt window but when i host application on server its behaviour is strange .It shows Command prompt in taskbar manager but not open Command prompt window.I want to run exe file on server.Here is my code.
prc.StartInfo.CreateNoWindow = true;
prc.StartInfo.UseShellExecute = false;
prc.StartInfo.FileName ="cmd.exe";
prc.Start();
Upvotes: 1
Views: 304
Reputation: 33
Please try this code
prc.StartInfo.CreateNoWindow = true;
prc.StartInfo.UseShellExecute = false;
prc.StartInfo.FileName ="cmd.exe";
prc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
prc.Start();
OR
prc.StartInfo.UseShellExecute = false;
prc.StartInfo.FileName ="cmd.exe";
prc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
prc.Start();
To run the process without any window:
Using CreateNoWindow=true requires UseShellExecute=false
CreateNoWindow = true;
This can be changed on the fly:
To hide and show the window
WindowStyle = ProcessWindowStyle.Hidden;
Upvotes: 0