I am trying to create a batch file to kill a process only if it is running. I found a pskill tool from windows xp tool site but when I put it in the batch file and scheduled the task, a black window always flash to kill the process no matter if it is running or not. My question is:
1. How do I put it in the batch to run this pskill by detecting if it alive first.
Or–2. How do I get this scheduled task run minimized or another secretive way? I don’t want to see the black window popping up.
Thanks a lot if you could help me! Note: I can make the batch file run minimized from its property setting but when it is in scheduled task, I couldn’t get it to minimize anymore.
You can use the TASKKILL command with the /FI switch that has an operator of e and a value of RUNNNING
It might look something like this:
TASKKILL /F /IM notepad.exe /FI STATUS ne RUNNING
Type the TASKKILL /? to see all the possible filers,operators and values.