We all have faced the issue that some Processes are not responding and sometimes, it also hangs the system. These issues are often resolved automatically by Windows OS, but sometimes it could take a lot of time. In such situations, the rapid fix is to use the “X (Close Button)” or “ALT + 4” keys to close the applications. But what if these shortcuts don’t work because the process is not responding?
Well! In such situations, Windows users can use the Task Manager to forcefully close the applications or use the “Taskkill” command. The “Taskkill” command is an efficient approach that lets you instantly kill an application.
Covered Content:
This guide explains the “Taskkill” command and sheds light on its flags using the following content:
Let’s explore the above content.
Understanding the Taskkill Command on Windows
The “Taskkill” is a native Windows command line utility that allows you to kill any process via its process ID (PID) or by its name. It is a powerful command that can also crash your system if used without caution.
Let’s understand the syntax of the “Taskkill”:
TASKKILL [/S system [/U username [/P [password]]]] { [/FI filter] [/PID processid | /IM imagename] } [/T] [/F]
Here,
- The “TASKKILL” invokes the “Taskkill command”.
- The “/S system” specifies the remote system, the “/U username” is the remote system’s username, and the “/P password” is the remote system’s user password.
- The “/FI filter” tells the “Taskkill command” to apply the kill filters for the processes.
- The “/PID processid” is the ID given by the Windows OS to the process. You can use this ID to kill the process linked to it.
- The “/IM imagename” is the executable file (.exe) running.
- The “/T” flag tells the “Taskkill command” to kill all child processes associated with the process you are killing.
- The “/F” makes the “Taskkill” command to forcefully execute the specified Process.
How to Use the Taskkill Command on Windows
The following are examples of Windows “Taskkill” command to help you better understand it.
- Example 1: Kill/Terminate a Process Using its PID.
- Example 2: Kill/Terminate a Process Using its Imagename.
- Example 3: Kill/Terminate a Process Forcefully.
- Example 4: Kill/Terminate a Process and its Child Processes.
- Example 5: Remotely Kill the Process
- Example 6: Kill/Terminate a Process Using the Filters.
The illustration of the above examples is as follows:
Example 1: Kill/Terminate a Process Using its PID | Taskkill Windows
You must use the “/PID <Process ID>” format to kill a Process using its PID. It sends a termination request to the specified Process to quit gracefully. To find the PID of the Processes, use the “tasklist” command as follows:
tasklist
Now use the “Taskkill” command to kill a Process based on its ID:
Taskkill /PID 15076
Note: You can kill/terminate multiple processes using the space-separated syntax as follows: “/PID 1 /PID 2 /PID 3”.
Example 2: Kill/Terminate a Process Using its Imagename | Taskkill Windows
The “Imagename” in Windows refers to the executable or .exe file’s name. You can find the list of all the image names via the “tasklist” command. After finding the specified Process’s imagename, run the below-stated command to send a termination (kill it gracefully) to it:
taskkill /IM mspaint.exe
Note: You can kill multiple processes using the “/IM app1.exe /IM app2.exe” format.
Example 3: Kill/Terminate a Process Forcefully | Taskkill Windows
The term “forcefully terminate” means killing the specified process instantly with no grace. To forcefully kill a process, use the “/f” flag of the “Taskkill Command” as follows:
taskkill /f /PID 14832
Instead of the PID such as the above, you can use the process’s imagename as well to kill a specific process:
taskkill /f /IM Taskmgr.exe
Example 4: Kill/Terminate a Process and its Child Processes | Taskkill Windows
If you want to kill a process or Process with all its child processes, use the “/t” flag of the “Taskkill Command”, as seen below:
taskkill /t <Parent Process ID>
To find the parent process ID against a specific process, use the following command (after finding the process ID via the Tasklist command):
wmic process get ProcessID, ParentProcessID | find "<Process ID From the Tasklist"
Example 5: Remotely Kill the Process | Taskkill Windows
To kill the process remotely using the “Taskkill” command, follow the below-mentioned syntax and replace the credentials and flags accordingly:
TASKKILL [/S <Remote System’s Name or IP> [/U <username> [/P <password>]]] [/FI filter] [/PID ProcessID| /IM Imagename]
You may face the error saying “The RPC Server is unavailable” or anything like that. To fix it, enable the WMI or Windows Management Instrumentation in the Windows Firewall. For this purpose, execute the below command in the Windows PowerShell:
Enable-NetFirewallRule -DisplayGroup "Windows Management Instrumentation (WMI)"
Note: The “Taskkill” always uses a “/f” flag when operated remotely.
Example 6: Kill/Terminate a Process Using the Filters | Taskkill Windows
The “Taskkill Command in Windows” offers a few filters that you can use to kill/terminate the processes. The Taskkill command’s filters are explained as follows:
Filter Name | Useable Operators | Values |
---|---|---|
Status | EQ (Equal to), NE (Not Equal to) | Running, Unknown, Not Responding. |
Imagename | Same as Status | Imagename. |
PID | EQ, NE, GT (Greater or equal to), LT (Less than or equal to), GE (Greater or equal to), LE (Less equal to) | PID. |
Session | Same as PID | Session. |
Memory Usage | Same as PID | Memory usage in Kilobytes. |
Username | EQ and NE | Username. |
Modules | Same as username | Dynamic Link Library or DLL name. |
Services | Same as username | Service’s title/name. |
Windowstitle | Same as username | The title assigned to the Window. |
Kill All “Not Responding Programs” in Windows
To kill all “Not Responding Programs” in Windows, use the following command in the elevated Command Prompt or Windows PowerShell:
taskkill.exe /f /fi "status eq not responding"
Here,
- The “/fi” is for the filter.
- The “status eq not responding” is the query for the “Taskkill” command to perform.
By following the above syntax, you can use the “Filters for Taskkill Command” in Windows accordingly.
You can create a shortcut to kill/terminate all not-responding processes via the following steps:
Step 1: Create a Shortcut by right-clicking on the Desktop screen, navigating to New, and then selecting the Shortcut option.
Step 2: In the shortcut, specify the location “C:\Windows\System32\taskkill.exe /f /fi “status eq not responding”” and hit the “Next” button:
Step 3: Now open the Properties of the shortcut and from the General tab, go to Advanced options. From the Advanced Properties, mark the option “Run as administrator” and OK it:
Step 4: Now Create a Shortcut key for the Taskkill shortcut from the Shortcut tab. In the Shortcut Key option, press any key and it will generate the combination, i.e, Ctrl + Alt + L:
Now press the specified keys every time you want to kill the “Not Responding” processes.
Pro Tips
Use the Windows Task Manager (press Ctrl + Shift + Escape keys) and find the process you want to kill/terminate, right-click it, and select the End Task option to do so:
You can also view the child processes and kill/terminate them separately:
That’s how the Taskkill command works on Windows.
Final Words
The “Taskkill Windows Command” lets you kill/terminate the processes using the command line (Command Prompt and Windows PowerShell). It includes several flags and Filters that allow you to kill any process (not the system’s processes). To kill/eliminate a process using the “Taskkill” command, you can use the “Process ID (PID)” or “Imagename”. Additionally, the “Taskkill” command can also kill the processes remotely, as discussed above in this detailed guide.