The Command Prompt is home to many powerful utilities that can help you troubleshoot problems or even fix your Windows installation. Along with the usual culprits like the System File Checker and Diskpart, the Taskkill command is another useful tool for any Windows user.
As the name suggests, the command can kill tasks and processes, freeing up system resources. It is more useful than other similar methods because of its versatile filtering options, allowing a clever user to set up automated kill lists to prevent unnecessary programs from hogging memory.
To get you started, here is a short primer on how to use the Taskkill command on Windows 10 or 11.
Why Do You Need to Use the Taskkill Command?
Using the Taskkill command isn’t the only way to shut down Windows tasks and processes. The most common way of killing a process is through the Task Manager.
The Task Manager allows you to view all running processes and end any process with a few clicks. This method is easy to use and doesn’t require you to painstakingly type in code in a black terminal. Why then should you even bother with Taskkill?
Versatility. If you only want to kill a couple of extra processes every now and then, the Task Manager is undoubtedly the best tool for the job. But if you wish to end a large number of processes daily, you need a method with a bit more customization.
With the Taskkill command, it is possible to shut down whole batches of processes at once, based on specific filters. You can even set up certain commands as shortcuts, allowing you to run them with a double-click from the desktop at any time.
The Basic Syntax of Taskkill
- To use the Taskkill command directly, we first need to open the Command Prompt. Simply search for cmd in the Start Menu and select Run as Administrator.
- To kill a process with the Taskkill command, you need its name or its PID. Entering tasklist will give you a complete list of all running processes, along with their PIDs and memory usage.
- You can now use the command tasklist /IM “NAME” /F to kill any process, where NAME has to be replaced with the actual name of the task you are looking to end. The /F parameter forces the process to terminate, which can be useful for many pesky tasks that don’t want to shut down.
- To use the PID instead, enter taskkill /IM PID /F, where PID is the numerical value of the process from the previous list. The results are the same.
Using Taskkill With Filtering Flags
So far, the taskkill command may just seem like a more convoluted way of doing what the Task Manager could already do. Using tasklist to get the names of all running processes and targeting each one manually is a rather tedious way of terminating a task.
But that’s not the only way to use taskkill. There are many filtering options you can use to automatically find particular types of processes and kill them without having to know their names or PIDs.
Here are all the filters available for use with taskkill:
- STATUS: Basically, the status of the process. Can be RUNNING, NOT RESPONDING, or UNKNOWN.
- IMAGENAME: The same names brought up by tasklist.
- PID: A numeric ID that can be seen through the tasklist command.
- SESSION: The session number.
- CPUTIME: The duration for which the process has been using the CPU. It’s given in the standard double-digit hours:minutes:seconds format.
- MEMUSAGE: The memory usage of the task in KB.
- USERNAME: The name of the user account from which the task has originated.
- MODULES: Name of the DLL being used by the process.
- SERVICES: For processes associated with Windows services, this gives the name of the service.
- WINDOWTITLE: As it says, the title of the process window.
Some of these filtering options are more useful than others. For example, you can use the USERNAME option to shut down processes from a particular user, which can be useful in managing networked computers.
Most of these filters can also be combined with logical operators. But instead of using mathematical symbols, they are denoted by contractions of the actual phrases. For example, equal to becomes eq, not equal to becomes ne, greater than becomes gt, and so on.
To demonstrate, here is the command to end all processes that are not responding:
taskkill /FI “STATUS eq NOT RESPONDING” /F.
The /FI flag must be included for using any filter, followed by a string containing the filtering expression. All other filtering options can be used similarly, terminating processes matching a set condition.
Creating Taskkill Applications With File Shortcuts
Running Taskkill commands from the Command Prompt isn’t the only thing you can do with the tool. You can bind a Taskkill command to a desktop shortcut to use it instantly as well. This allows you to execute a particular kill list without opening up cmd and entering a bunch of text in it.
- To create a taskkill app, right-click on any empty space on your desktop and select New > Shortcut.
- Now in the target for the shortcut, we’ll enter the taskkill command, prefaced by taskkill.exe to allow it to run. Using the same command we demonstrated in the previous section, we get taskkill.exe /FI “STATUS eq NOT RESPONDING” /F.
- Just save this shortcut with any name you want, and you’re good to go. Double-click on this newly created shortcut at any time to instantly terminate all not responding processes.
Clean-up System Memory With the Taskkill Command
The Taskkill command is a brilliant way to end many similar tasks at once without manually going over each individual process in the Task Manager. It might seem a bit daunting to use at first, but once you get the hang of it, you’ll find it relatively easy to work with.
The host of filtering options makes Taskkill a potent and flexible tool. It allows you to kill processes based on parameters rather than having to determine individual tasks on your own judgment.
Better yet, you can easily save specific Taskkill commands as desktop shortcuts. They act as mini-apps you can use without a hassle to kill a class of useless processes at once.