I use the below statements in my application:
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = 'FileName';
process.Start();
process.WaitForExit(900000); // 15 minutes
How does it work? After 15 minutes, if the 'FileName' is still running/executing, will process.WaitForExit(900000); kill the process? Else the execution goes to the next statement without killing the 'FileName', i.e. 'FileName' continue to run till it's execution completed?
Yes, if a time-limited WaitForExit returns due to the limit being elapsed the process continues to run.
You could try
Process.CloseMainWindow();
this will close the main window of your application and therefore end it smoothly.
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