Name: Stella Yang Date: June 17, 2005 at 07:44:26 Pacific Subject: A batch file to kill a process OS: windows XP CPU/Ram: 2.0 GHz and 512 MB
Comment:
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.
Dr. Nick, Thanks! I simply not aware of that command. But pskill command does the same -- pskill notepad.exe.
I still have the same problem with taskkill when it is in scheduled task with a black window popping up to kill the process even if the process is not running. Anyway to avoid that? Are you aware of any DOS command to run conditioned command? Like "if EXIST (processname). (taskkill processname)"....
Are you just trying to prevent the black box from poping up? If this is the case then even if you got the If statement to work you'd still see the black box.
I'm not sure if there's a way to run that command without seeing the command window. The box only pops up for a second, why is that a problem?
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.
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE