Reputation: 101
This is my code
System.Diagnostics.ProcessStartInfo proc = new System.Diagnostics.ProcessStartInfo();
proc.FileName = @"cmd.exe";
proc.Arguments = "/C "+ "ipconfig" ;
System.Diagnostics.Process.Start(proc);
when I run this code , Cmd run and shut down so quickly . How to pause it ?
THANKS A LOT :)
Upvotes: 6
Views: 8172
Reputation: 1859
Specify the K parameter instead of C
From Microsoft documentation:
/c : Carries out the command specified by string and then stops.
/k : Carries out the command specified by string and continues.
proc.Arguments = "/K "+ "ipconfig" ;
more info: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/cmd.mspx?mfr=true
Upvotes: 6