Page 1 of 1

script to terminate process in task manager

Posted: 14 Oct 2009 17:17
by swan_x
i need a script to terminate end process in task manager….
ex. end explorer.exe

Re: script to terminate process in task manager

Posted: 14 Oct 2009 19:14
by zer0
swan_x wrote:i need a script to terminate end process in task manager….
ex. end explorer.exe
To make use of the script below, you need to know the name or ID of the process. Usually, the name of a process is its EXE's name. So, for Notepad, it's "notepad.exe" etc

If you wish to have a set script to kill a specific process then use this:

Code: Select all

run 'cmd /c TASKKILL /F /IM "[INSERT PROCESS NAME OR ID HERE]"';
so for explorer.exe it will be

Code: Select all

run 'cmd /c TASKKILL /F /IM "explorer.exe"';

Re: script to terminate process in task manager

Posted: 14 Oct 2009 19:17
by serendipity
zer0 wrote:
swan_x wrote:i need a script to terminate end process in task manager….
ex. end explorer.exe
To make use of the script below, you need to know the name or ID of the process. Usually, the name of a process is its EXE's name. So, for Notepad, it's "notepad.exe" etc

If you wish to have a set script to kill a specific process then use this:

Code: Select all

run 'cmd /c TASKKILL /F /IM "[INSERT PROCESS NAME OR ID HERE]"';
so for explorer.exe it will be

Code: Select all

run 'cmd /c TASKKILL /F /IM "explorer.exe"';
A duplicate post here:
http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=4181

@swan_x: can you please delete one of the posts?

Re: script to terminate process in task manager

Posted: 15 Oct 2009 10:19
by swan_x
@ zer0
ok! work! tanxs! please delete for me my other post in "Script Exchange".....

Re: script to terminate process in task manager

Posted: 15 Oct 2009 10:48
by j_c_hallgren
swan_x wrote:@ zer0
ok! work! tanxs! please delete for me my other post in "Script Exchange".....
You can usually delete you own posts while they are first posted, but only Don/admin can delete a post/thread once it has been replied to...zer0 was just asking you to do so as a fellow user, and he may not have known that limitation...I ran into it myself just this week...you can edit a post after reply and delete contents but that still leaves the thread there.

A second thread was never needed as once it has been replied to, even if in the wrong forum, it generally has to remain in the original location...and so when you created the duplicate, and serendipity answered that one, it got "locked in" there, as did this first one.

Re: script to terminate process in task manager

Posted: 15 Oct 2009 15:41
by swan_x
ok! i have 3 file to terminate...
a.exe
b.exe
c.exe

run 'cmd /c TASKKILL /F /IM "a.exe" TASKKILL /F /IM "b.exe" TASKKILL /F /IM "c.exe"';

but not work.... :cry:

Re: script to terminate process in task manager

Posted: 15 Oct 2009 15:51
by zer0
swan_x wrote:ok! i have 3 file to terminate...
a.exe
b.exe
c.exe

run 'cmd /c TASKKILL /F /IM "a.exe" TASKKILL /F /IM "b.exe" TASKKILL /F /IM "c.exe"';

but not work.... :cry:
I don't think you can put all 3 in 1 line of run command. You need 3 separate ones, which you can combine into a single script effectively achieving the same result.

Re: script to terminate process in task manager

Posted: 15 Oct 2009 16:16
by TheQwerty
zer0 wrote:
swan_x wrote:ok! i have 3 file to terminate...
a.exe
b.exe
c.exe

run 'cmd /c TASKKILL /F /IM "a.exe" TASKKILL /F /IM "b.exe" TASKKILL /F /IM "c.exe"';

but not work.... :cry:
I don't think you can put all 3 in 1 line of run command. You need 3 separate ones, which you can combine into a single script effectively achieving the same result.
You should be able to combine them by separating them with "&&", but this has the side affect that if one fails all that follow are not performed.

Code: Select all

run 'cmd /c TASKKILL /F /IM "a.exe" && TASKKILL /F /IM "b.exe" && TASKKILL /F /IM "c.exe"';

Re: script to terminate process in task manager

Posted: 15 Oct 2009 17:14
by swan_x
@ TheQwerty

yes! yes! yes! yes! yes! yes! yes! yes! yes!
tanxsssssssss

Re: script to terminate process in task manager

Posted: 15 Oct 2009 17:20
by swan_x
one clarification...

after launch my script
run 'cmd /c TASKKILL /F /IM "a.exe" && TASKKILL /F /IM "b.exe" && TASKKILL /F /IM "c.exe"';

explorer.exe crash...!! and after the message "Send Error to microsoft".....why???

Re: script to terminate process in task manager

Posted: 15 Oct 2009 17:36
by TheQwerty
This would all be a lot easier if you just posted your script and explained what the heck you were trying to do.

Frankly, all these small snippets give me the feeling that you're using the wrong tool for the job and would be better off asking someone to write a script in an appropriate language for what you want.

Re: script to terminate process in task manager

Posted: 15 Oct 2009 17:44
by swan_x
no, no! your script work!
is not the case for something so silly!
thanks again!

Re: script to terminate process in task manager

Posted: 15 Oct 2009 17:51
by swan_x
the variable /F /IM what are??
Perhaps this variables generates the crash in explorer...

Re: script to terminate process in task manager

Posted: 15 Oct 2009 17:57
by j_c_hallgren
swan_x wrote:the variable /F /IM what are??
Perhaps this variables generates the crash in explorer...
A simple Google search gives me this site which seems to explain it quite well: http://commandwindows.com/taskkill.htm

It seems that English is not your native language which may be part of the problem here.