Taskkill: How to Kill Multiple Processes From the Command Line

To kill multiple programs at once from the command line, run taskkill with several /PID or /IM switches (for example taskkill /IM notepad.exe /IM calc.exe), or use /FI filters and /IM * to end every process that matches a condition. Add /F to force the kill and /T to end child processes too.
This guide covers the syntax, the filters and operators taskkill supports, and practical examples for local and remote computers.
How taskkill ends a process
Taskkill is a built-in Windows command that ends processes by image name or process ID. It is useful when a program is not responding, the close button does nothing, or Task Manager fails to end the process. Run taskkill /? to list all parameters.
The two core options are:
- taskkill /IM explorer.exe
- taskkill /PID 1516
/IM takes the image name that you see when you run tasklist or look at the Details tab in Windows Task Manager, and it ends every process with that name. /PID ends one specific process, which is the safer choice when several instances of a program are running.
Kill multiple processes in one command
To end several processes in one command, repeat the /PID or /IM switch once per target. Microsoft documents this form: taskkill /pid 1230 /pid 1241 /pid 1253.
- taskkill /PID 123 /PID 234 /PID 345
- taskkill /IM chrome.exe /IM firefox.exe
Two switches change how the kill behaves. /F forces the process to end, and /T ends the process together with all child processes it started. Combined, taskkill /F /T /IM program.exe is the usual way to clear a program that keeps respawning helper processes.
Filter processes with /FI
The /FI parameter selects processes by a condition, so one command can end a whole batch. Each filter has the form "NAME operator value". Microsoft lists these filter names and operators:
| Filter | Operators | Value |
|---|---|---|
| STATUS | eq, ne | RUNNING, NOT RESPONDING, UNKNOWN |
| IMAGENAME | eq, ne | Image name |
| PID, SESSION, MEMUSAGE | eq, ne, gt, lt, ge, le | Number (MEMUSAGE in KB) |
| CPUTIME | eq, ne, gt, lt, ge, le | HH:MM:SS |
| USERNAME, SERVICES, WINDOWTITLE, MODULES | eq, ne | User, service name, window title, DLL name |
The operators mean eq equal, ne not equal, gt greater than, lt less than, ge greater or equal and le less or equal. You can combine several /FI filters in one command. Wildcards work with /IM only when at least one filter is specified.
Taskkill examples
These commands cover the common cases:
- taskkill /FI "STATUS eq NOT RESPONDING" ends all processes that Windows reports as not responding.
- taskkill /FI "USERNAME eq MARTIN" ends all processes that run under the user MARTIN.
- taskkill /F /FI "PID ge 1000" /IM * forcefully ends every process with a PID of 1000 or higher. Do not run this on a PC you care about, it also ends system and shell processes.
- taskkill /S servername /FI "IMAGENAME eq rog*" /IM * ends all processes on the remote computer whose names start with rog.
Test a filter first by running the same /FI expression with tasklist, which lists what would match without ending anything.
Run taskkill on a remote computer
Taskkill can end processes on another computer with /S for the computer name or IP address. Add /U (in the form Domain\User) and /P to supply credentials, for example /U coredomain\martin /P password. Microsoft notes that /U works only together with /S, that remote processes are always ended forcefully whatever you pass for /F, and that the WINDOWTITLE and STATUS filters are not supported for remote systems. Typing a password in plain text leaves it in the console history, so omit /P to be prompted instead.
Microsoft documents every parameter in its taskkill command reference.
Related: How to use the Windows shutdown command, Process Lasso review
God tip, or can download my application to close any process by name or multiples process that match by name, example resetapp.exe -close “excel” -issequence true close all open excel process (multiple session of the program) http://marjuanm.blogspot.mx/2015/04/resetapp-reiniciando-o-cerrando.html
I do this with Autohotkey, and assign various kills to hotkeys. It’s a good way to avoid “are you sure you want to close this?” nags
A question: In the image illustrating /?, the expression FI appears in the 4th and 5th examples. FI is not explained in the text or image, so I was hoping you or a fellow reader would explain it to me. I’m sorry if I am being dense!
A remark: The neat little program ‘close all’ does close all running programs provided nothing malicious is going on and is pretty handy: http://www.ntwind.com/software/utilities/close-all.html
/FI is the filter argument and what follows specifies that filter.