I want to kill a process ONLY IF the process exists, I want to do this because I have a tool that runs only if there is no error and I made some tests and indeed there is an error when I try to kill a process that doesn’t exists. This is the line I use to kill a process:
taskkill /f /IM notepad.exe
But I want to validate it only executes when the process EXISTS.
Thank you!!!
Taken from this question, you should try this code:
If that does not help, you can look at this and this question.
I hope it helps!