You are here

Terminate multiple programs from the command line with Taskkill

Not all program termination options work all the time. If a program is not responding, you may not be able to use the window close button to terminate it. The same may be true for killing the process in the Windows Task Manager.

Taskkill is a versatile command line tool that you can use for these purposes. Among the many features that it supports is an option to close programs forcefully and to terminate multiple programs in a single operation.

Especially the latter can be useful if you need to clear rogue programs on your system that spawn new processes as soon as you terminate them.

The basic command is taskkill followed by parameters. A good starting point is to run taskkill /? to display the help text listing all parameters that you can use.

To terminate a process, you can use the following two core options:

  1. taskkill /IM explorer.exe
  2. taskkill /PID 1516

The first refers to the image name of the program running which you get when you run tasklist on the command line or by using the Windows Task Manager. The second the process ID of the process which you get in the same way.

task list

Using the image name will kill all processes of that name. The process ID on the other hand allows you to select a specific process instead.

To terminate multiple processes at once use the following command.

  1. taskkill /PID 123 /PID 234 /PID 345

The parameter /f specifies that the selected processes should be terminated forcefully while /t that all of its child processes should be terminated along with it.


What makes taskkill particularly powerful is its filtering system. You can use filters to terminate matching processes to kill a whole batch of them at the same time.

Filters use the /fi parameter followed by instructions what you want to filter. The operators used here are:

  1. eq equal
  2. ne not equal
  3. gt greater than
  4. lt less than
  5. ge greater or equal
  6. le lesser or equal

Interesting filter names are IMAGENAME, CPUTIME, MEMUSAGE or USERNAME among others (see screenshot above for all of them and the operators they support).

As you can see, wildcards are supported. You can only use wildcards for /IM when at least one filter is specified.

Some examples:

  1. taskkill /FI "STATUS eq NOT RESPONDING"
  2. taskkill /FI "USERNAME eq MARTIN"
  3. taskkill /s servername /FI "IMAGENAME eq rog*" /im *

What they do

  1. Terminates all running processes with the status not responding
  2. Terminates all running processes by the user MARTIN
  3. Terminates all image names starting with rog on the server servername

You use the parameters /p and /u to set a password and username if necessary.  The user parameter comes in the form Domain\User e.g. /u coredomain\martin /p secretpassword

Additional information are provided on Microsoft's Technet website

This article was first seen on ComTek's "TekBits" Technology News


Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer