XP: kill a Windows process from the command line with taskkill
The ability to perform tasks from a system’s command line allows those tasks to be used in batch files. This recipe describes several uses of taskkill to terminate Windows processes.
If you know the name of a process to kill, for example notepad.exe, use the following command from a command prompt to end it:
taskkill /IM notepad.exe
This will cause the program to terminate gracefully, asking for confirmation if there are unsaved changes. To forcefully kill the same process, add the /F option to the command line. Be careful with the /F option as it will terminate all matching processes without confirmation.
To kill a single instance of a process, specify its process id (PID). For example, if the desired process has a PID of 827, use the following command to kill it:
taskkill /PID 827
Using filters, a variety of different patterns can be used to specify the processes to kill. For example, the following filter syntax will forcefully kill all processes owned by the user Quinn:
taskkill /F /FI "USERNAME eq Quinn"
The following table shows the available filters and their use.
Filter Name Valid Operators Valid Value(s)
----------- --------------- --------------
STATUS eq ne RUNNING | NOT RESPONDING
IMAGENAME eq ne Image name
PID eq ne gt lt ge le PID value
SESSION eq ne gt lt ge le Session number.
CPUTIME eq ne gt lt ge le CPU time in the format
of hh:mm:ss.
MEMUSAGE eq ne gt lt ge le Memory usage in KB
USERNAME eq ne User name in [domain\]user
format
MODULES eq ne DLL name
SERVICES eq ne Service name
WINDOWTITLE eq ne Window title
eq: equals ne: not equal
gt: greater than lt: less than
gt: greater than or equal le: less than or equal









coder said on October 6, 2008
Check for hardware or memory faults. If there are hardware issues then it will slowly corrupt your OS in odd ways eventually causing it to crash more often.
Also check for driver issues/conflicts. If a device keeps making hardware interrupt calls it will force the system to respond but if the driver is not going to respond properly it may freeze or just take forever to come back.
Kevski said on October 11, 2008
anyone know which service is associated with this? I get the following reply when I run this from the cmd line:
TASKKILL /F/ IM DTFMON.EXE
“ERROR: The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.”
farouk said on October 24, 2008
good article
i cant find this command on xp, what to do??
Dez said on November 7, 2008
awesome, thanks m8
Dev said on November 17, 2008
taskkill doesnt work for me!!
Hern said on December 16, 2008
I prefer using Daphne which has it’s own command line tool for listing and killing processes.
seg said on December 17, 2008
am not getting exactly…and in my cmd its not working…can u mail me?
matrixjon42@yahoo.com
deen said on December 18, 2008
wow very short are there any simple technique to kill the process
ADSF said on December 23, 2008
TRY /F FOR ANOTHER USERS PROCESS KILLING , GR8 FUN TO DO SO ;)
Anonymous said on January 2, 2009
tskill works.
Dan said on January 3, 2009
“gt: greater than or equal le: less than or equal”
This is incorrect. “ge” is greater than or equal.
Dan
aathisankar said on February 15, 2009
Thanks a lot .. i have been searching for this command a week//
It was really useful for my project … :-)
Vivek said on March 28, 2009
thanks ,really i got what expected
swapnil said on April 8, 2009
Really cool… thanks for the help….. Toad 9 sucks
Nikhil Bhatt said on May 7, 2009
Thanks Guys This Command Helped Me A LOT !!!!!!
Thanks once again !!!!
Rama said on May 11, 2009
I try this and nothing happen. Where do I see changes? But now computer make the grinding noise all time. How to undo command?
Breno said on May 12, 2009
Taskkill uses WMI API to search process by name. Enable Windows Management Instrumentation (winmgmt) to use /IM.
GFYM said on June 8, 2009
only in XP Pro, not in XP Home
fgf said on June 10, 2009
Sooo how do i shutdown fortiguard and stuff at school to get past internet filter?
kelvin said on June 22, 2009
Hello oooo!
I just want to thank you guy for the content of the site i just click on it and on like other sites i have been i didnt regret it..
i really learnt new stuff especially based on programming (straight shit now long talks … good examples)
just wanna know how i can join the crew…
men you guys are the boooomb… keep it up.
thanks
Kelvin.
Tichomir Mitkov said on June 28, 2009
cool, man !
pawan said on July 1, 2009
How to the wht is PID of a process
Vesa said on July 5, 2009
On Vista (Premium) cmd: taskkill /F /FI “USERNAME eq Quinn” messes up the explorer.exe .. :)
Fernando said on July 8, 2009
cool :) Really Thanks
Anonymous said on July 12, 2009
How about killing only the last instance of the program and not the first on
morph said on July 14, 2009
@thedylman These utilities are available only for xp pro.
You can couple it with the tasklist /SVC command to see the process id of the process and then use taskkill on it that way you can be sure of the process you are terminating and can also spot malwares. See this link
Anonymous said on July 27, 2009
I guess you learn new things every day. I’ve been using the command line for years, and I didn’t know about this. I’ve always been using tskill, though I suppose there is little difference in the end, eh?
Abc said on August 4, 2009
This is good information
- cheers
e. edwards said on August 18, 2009
Small typo right above the ‘Add New Comment’ box:
Greater than or equal should be ‘ge’, not ‘gt’.
Anil said on August 28, 2009
thanks …quite helpful information..
Anonymous said on September 10, 2009
to kill notepad we have to but .exe so what if want to kill media player or
an client server on some pc’s in network ?!!???!
Anonymous said on September 10, 2009
Thank you, qmchenry!
Works as expected.
jon said on December 2, 2009
You say this is for services and it is not. Processes are different from services, look it up
Menea said on January 10, 2010
It simply does not work [if anyone says 'yes, it works' then simply lies].
You run it, it says ‘SUCCESS: The process “xxxxx.exe” with PID 1860 has been terminated’ but… process still running. You run second time and again ’success’ ‘SUCCESS: The process “xxxx.exe” with PID 1860 has been terminated’… and so on.
Germino said on February 12, 2010
Thank you very much !!
Mechanic said on March 4, 2010
Thank You!
It’s amazing to know that XP has such built-in command.
I’ve tried to use Toolhelp32 API to kill processes, but it doesn’t enumerate processes spawned by another users (not current).
That tool kills processes with image name independent of the user’s context it’s running!
Thanks!
Anonymous said on March 5, 2010
it works,,,,,,,,,, Thanks…..
Rajesh Naik said on April 11, 2010
I get access denied for process which are started with Administrator privileges. Anyone know how to kill process started with elevated access.
Anonymous said on April 13, 2010
cool
Anonymous said on April 22, 2010
When not succeeding in stopping use “net stop (service)” instead
Ali said on June 1, 2010
I couldn’t get the taskkill to execute on cmd. Did I miss something?
tung said on June 23, 2010
oip
Svanstaaden said on June 25, 2010
Ok, but what about processes that don’t terminate in XP although you called the taskkill /f /im PROCESSNAME ??!?!?!? Some process might say : “Access denied” . How are those killed ?! And please don’t tell me it doesn’t work – The shutdown kills everything, wether or not it is “access denied”, so how does the shutdown get it right to kill ALL processes ?!
Jujaja said on June 26, 2010
ХУЙНЯ! БЛЯ ПИЗДЕЦ! НИХУЯ НЕ РАБОТАЕТ! АВТАР ДАЛБАЁБ! СУКА”
Coldfire Coldfire said on July 31, 2010
ABC said on August 3, 2010
thanks… got the solution…
Greiciunas2010 said on August 18, 2010
Thanks for the help. This one actually save me much time.
Motogpwade said on August 26, 2010
hi i just did this but the process is still there and it wont die.
please help?
Abhi said on September 3, 2010
I am really happy with the solutions that are uploaded on the web site. they are awesome and reliable.
Best Regards, abhi
http:
Rob said on September 8, 2010
moral of the story: don’t buy HOME edition when you want to automate
Dawood said on September 14, 2010
tooooo good , Thxxx Bro
Aa said on September 16, 2010
Thanks, I was looking for it
Lolmismo said on October 9, 2010
thanks :P
Mokka said on October 20, 2010
But it doesnt the system critical process…. Try killing services.exe
Usha Topagi said on October 20, 2010
Could some one please help me for closing the Outlook window?
Problem: I have Outlook 2003 running on XP. I have opened many Outlook mail items. By finding window title of the mail item i want to close the window, but not the Outlook process.
I tried the below code, but it is not working for Outlook windows
1) C:> taskkill /F /FI “WINDOWTITLE eq Document1 – Message (HTML)” –
This winow will open when we try to send email from MS Word (File – Send To – Mail Recipient (as attachment))
2) C:>taskkill /F /FI “WINDOWTITLE eq FW: Secure Email – HLD – Sign-off – Message (HTML)”
Growing_wearyz said on October 23, 2010
so in theory your trojan may not be so successful on a windows XP Home Edition Computer :P
ur an idiot said on December 2, 2010
alt F4
Bill Gates said on December 19, 2010
it works if you put
tskill “firefox”
Bill Gates said on December 19, 2010
Works
Billgates said on December 19, 2010
yes but it depends on what version of windows you use
Sywa said on January 6, 2011
Here is simple example on taskkill to kill a process using a port 2425:
> use this to find the associate Process using port 2425
netstat -ano | find “2425″
>return :
TCP 0.0.0.0:2425 0.0.0.0:0 LISTENING 3140
>Kill the process using port 2425
taskkill /PID 3140
where 3140 is the application PID using port 2425
Fredgimz said on January 6, 2011
Don’t know if it is an issue for all Windows, but i found on a windows 2003 server that the operator “gt” fails on my filter upon CPUTIME. (While this works correctly for tasklist.exe) my workaround was to use “ge” instead.
ie:
tasklist /FI “CPUTIME gt 00:30:00″ => success
taskkil /FI “CPUTIME gt 00:30:00″ => fails (no match found)
taskkill /FI “CPUTIME ge 00:30:00″ => success
nike outlet store said on January 7, 2011
You can couple it with the tasklist /SVC command to see the process id of the process and then use taskkill on it that way you can be sure of the process you are terminating and can also spot malwares.
Fredgimz said on January 7, 2011
Well, finally this was just a lucky strike, i cannot reproduce this..
The problem seems to concern the time string, results are very very inconsistent, with any combination of gt ge lt le.
It even doesn’t recognize my filter if i use 00:00:51 so 51s or above, while “51:51:50″ and even “00:69:00″ are fine !!!
It looks like the getting of time or something is completely fucked up…
Carlos_go said on January 10, 2011
I ve got a problem with tasklist. It runs in an Windows Server 2003 but doesnt run in Windows XP Profesional SP3. When my app hungs, the Task Manager shows me that is not responding but if I check it with the tasklist command, it shows me that is running,
I dont understand, because I check the services options between both operating systems and change them to be the same.
Thank you so much in advance!!
Dep_7 said on January 12, 2011
Yea, that on gt in the filters is a typo. It should be ge.
Sajmmon said on January 13, 2011
Great post.
I used it to kill hanged Excel.exe when working over RemoteDesktop. Is there any way to access TaskManager over the RemoteDesktop?
Regards
Edmon Daniel said on January 18, 2011
right click taskbar and Select “Start Task Manager”
Fggdfg said on May 7, 2011
werr
rif4fun said on August 8, 2011
your site is very helpfull
thanx
i wanna copy a part of your site to my blog :)
http://ragam-komputer.blogspot.com
Azazelahh said on August 15, 2011
This fix just made my life sublime. THNX!!!!
PasserBy said on October 27, 2011
Interesting how many strange comments there are on this post. Nice concise article though. Thanks.
My fast PC said on November 9, 2011
It’s yet another way shut down your processes. I personally don’t see any difficulties running the task manager panel. You all have them outlined and don’t need to remember the process name. Still, nice article.
jo said on November 17, 2011
really helpful post to me, as my env was not showing Task manager during critical hours and these commands helped to fix the problems. Thanks.
sid said on January 14, 2012
thanx it realy work…. thanx a lot for solve my prob…..