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:
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.
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.
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:
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.
What they do
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
Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.
We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.
If you like our content, and would like to help, please consider making a contribution:
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.