Labels

Tuesday, July 26, 2011

kill a Windows process from the command line with taskkill

  1. Runs command line as Administrator
  2. Terminate gracefully, asking for confirmation if there are unsaved changes
taskkill /IM notepad.exe
  1. /F option terminate all matching processes without confirmation.
  2. To kill a single instance of a process, specify its process id (PID)
taskkill /PID 827
  1. 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

No comments:

Post a Comment