Computing.Net > Forums > Programming > Batch File To Kill A Process

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch File To Kill A Process

Reply to Message Icon

Name: jkissl
Date: March 31, 2009 at 10:07:11 Pacific
OS: Windows XP
Subcategory: Batch
Comment:

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?



Sponsored Link
Ads by Google

Response Number 1
Name: reno
Date: April 2, 2009 at 01:35:18 Pacific
Reply:

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


0

Response Number 2
Name: jkissl
Date: April 2, 2009 at 12:08:51 Pacific
Reply:

Thanks for the reply, however it did not work, could you please show me the usage? or clarafy the code?


0

Response Number 3
Name: Razor2.3
Date: April 2, 2009 at 18:09:33 Pacific
Reply:

This seems like a bad idea. Why not simply deal with the offending .EXE, instead of trying to kill it?


0

Response Number 4
Name: jkissl
Date: April 3, 2009 at 05:53:57 Pacific
Reply:

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.


0

Response Number 5
Name: formeofme
Date: April 20, 2009 at 08:54:32 Pacific
Reply:

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


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch File To Kill A Process

A batch file to kill a process www.computing.net/answers/programming/a-batch-file-to-kill-a-process/12884.html

Batch File to Create a Shortcut www.computing.net/answers/programming/batch-file-to-create-a-shortcut/13374.html

Batch file to replace a word www.computing.net/answers/programming/batch-file-to-replace-a-word/15770.html