I want to restart some process. Lets call it someApp.exe.
How can I restart that process? It’s not my application. It’s some external program.
I want to restart some process. Lets call it someApp.exe. How can I restart
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What you want to do is:
There are some ways of obtaining a Process instance in C#. Let’s suppose you know the name of the process:
Then you can do:
But to start it again, you need to know the path of the process, so before killing it, save the path of the executable:
And then you can do:
You should check if
GetProcessesByNamereturns elements before taking the first element, but I just wanted to focus on the important thing here.