XP: kill a Windows process from the command line with taskkill

Home -> Windows

323919 views

From the computer of: qmchenry (335 recipes)
Created: Apr 26, 2004     Updated: Jun 15, 2007


19 comments:
View all comments

Add a comment

Add to:
Add to stumbleuponAdd to del.icio.usDigg itAdd to FURL

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

Subscribe to the Tech-Recipes Newsletter

You can get tips like this delivered in your email every week!

Enter your Email

We will never, ever sell your email address or spam you.




19 Recipe comments: View comments

XP: kill a Windows process from the command line with taskki by Anonymous
Re: XP: kill a Windows process from the command line with taskki by Anonymous
Re: XP: kill a Windows process from the command line with taskki by Anonymous
Taskkill on XP home by qmchenry
kill pocess that takes 40% cpu by Anonymous
Re: XP: kill a Windows process from the command line with taskki by Anonymous
Re: XP: kill a Windows process from the command line with taskki by davak
Re: XP: kill a Windows process from the command line with taskki by Anonymous
Re: XP: kill a Windows process from the command line with taskki by davak
Go get taskkill by Anonymous
Re: XP: kill a Windows process from the command line with taskki by Moorloch
Re: XP: kill a Windows process from the command line with taskki by Anonymous
Server 2003 by Anonymous
Re: XP: kill a Windows process from the command line with taskki by Anonymous
Re: XP: kill a Windows process from the command line with taskki by Anonymous
wanna know something by Anonymous
This website needs to be appreciated by sarge1238
Re: XP: kill a Windows process from the command line with taskki by pro-ipod
Re: XP: kill a Windows process from the command line with taskki by jkorr



Related recipes:

  See What Services Are Associated with a Process?
  XP Pro and Vista: List active Windows programs from command line with tasklist
  NT/2000/XP: Clearing relaunching spyware processes
  Windows XP/Vista: Use a Batch File for Quickly Restarting explorer.exe
  XP: Tasklist.exe - Get a List of Processes From the Command Line
  Disappearing or Closing Task Manager from AIM Virus/Trojan/Worm
  CMD: Add text to clipboard in DOS box/command line
  XP: Set or configure network interface to DHCP wtih netsh from command line
  Windows: You Can Move the Run Button
  Vista: Use BCDEDIT to change boot up options (dual boot w/XP Prof)

 

Sponsored links

 

Login

Nickname

Password

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.