Possible Duplicate:
Any way to keep an external command window open during a Process.Start(..)?
I've seen this post before but those solutions don't work for me for some reason. With Process.Start(), How can I keep cmd prompt open when the /K argument doesn't work? There's also no "WaitForExit" method available.
ProcessStartInfo processInfo = new ProcessStartInfo("cmd.exe", "/K " + "C:\\Windows\\System32\\" + "takeown.exe");
processInfo.Verb = "runas";
processInfo.Arguments = "/F \"C:\\Program Files(x86)\\Borland\" /R /D Y";
Process.Start(processInfo);
What I want to see is if the process processed successfully.
Thanks
You can wait for the process to finish before continuing:
var process = Process.Start(processInfo);
process.WaitForExit();
if (process.ExitCode != 0) {
// Handle failure...
}
Try this:
ProcessStartInfo processInfo = new ProcessStartInfo("cmd.exe");
processInfo.Verb = "runas";
processInfo.Arguments = "/K C:\\Windows\\System32\takeown.exe /F \"C:\\Program Files(x86)\\Borland\" /R /D Y";
Process.Start(processInfo);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With