Batch File To Kill A Process

March 31, 2009 at 10:07:11
Specs: Windows XP
On one of the computers that i use, there is a piticular process that starts up every few min. I was wondering how to write a batch file that Kills the process as it starts. i have created a looping batch file, but i was wondering if it could be stream lined.
@ECHO off
Title Pk

:top
Title Killing ********.exe
TASKKILL /F /T /IM ********.exe
Title Killing ********.exe
TASKKILL /F /T /IM ********.exe
Title Killing *******.exe
TASKKILL /F /T /IM *******.exe
Title Killing **********.exe
TASKKILL /F /T /IM **********.exe
goto :top

this is what i have, any way to make it kill the process only as they apper?


See More: Batch File To Kill A Process

Report •


#1
April 2, 2009 at 01:35:18
quote:
kill the process only as they apper

q="select * from __InstanceCreationEvent within 1 where " & _
"targetinstance isa 'win32_process' and "& _
"targetinstance.name='" & wsh.arguments(0) & "'"
set a=getobject("winmgmts:").execnotificationquery(q)

do:a.nextevent.targetinstance.terminate:loop

usage: monitor.vbs programname.exe


Report •

#2
April 2, 2009 at 12:08:51
Thanks for the reply, however it did not work, could you please show me the usage? or clarafy the code?

Report •

#3
April 2, 2009 at 18:09:33
This seems like a bad idea. Why not simply deal with the offending .EXE, instead of trying to kill it?

Report •

Related Solutions

#4
April 3, 2009 at 05:53:57
I have tried several other ways, however the most effective way is a batcfile, they are portable, dont require an install, and universal to most windows computers. The processes that i wish to end/kill are on several computers so portability is key.

Report •

#5
April 20, 2009 at 08:54:32
I would like to kill a java process it self

for using TASKKILL i need to get the current processId

can any on ehelp me on how to get that from java running code.

As i am planning to call a batch file from jav to kill itself


Report •


Ask Question