The Task Manager provides the ability to kill processes from its GUI. This can also be done via the command line using the Taskkill command. If you run the command with the id of a process or its name, you will be able to kill the task/process. Let’s see – the kill process from command line.
Execute the following command to end a process: kill service CMD –
Here is a command that allows us to terminate all processes associated with a specific executable.
taskkill /IM executablename
Example: MSPAINT.exe processes should be killed as follows:
c:\>taskkill /IM mspaint.exe
SUCCESS: Sent termination signal to the process "mspaint.exe" with PID 1972.
Force the end of a process –
There are times when it is necessary to forcefully kill applications. Tasklist, for instance, would ask for confirmation before killing Internet Explorer if there were multiple tabs open. The /F flag would be needed to kill Internet Explorer without asking the user for confirmation.
taskkill /F /IM iexplore.exe
The /F command kills the process. The user is prompted if it is necessary to save the opened tab pages in the above case if it is not used.
Following is the command that can be used to kill Windows Explorer:
C:\>taskkill /F /IM explorer.exe
SUCCESS: The process "explorer.exe" with PID 2432 has been terminated.
All GUI windows will disappear with the above command. To restart explorer, run the command ‘explorer’ from a command prompt.
A terminating signal would be sent if the /F option is not used. Users will be prompted to shut down if this option is not used.
C:\>taskkill /IM explorer.exe
SUCCESS: Sent termination signal to the process "explorer.exe" with PID 2432.
You can kill a process if it has the following id:
Below is a command that allows us to kill a process using it’s PID (process id).
taskkill /PID processId
Example: Dispatch PID 1234 to terminate a process.
taskkill /PID 1234
Get rid of high-memory consuming processes:
taskkill /FI "memusage gt value"
Here’s an example of what the below command would look like to kill processes that use more than 100MB of memory
taskkill /FI "memusage gt 102400"
Overloaded applications or systems with low memory available can sometimes hang. We usually kill the task/process when the application can’t be made usable and closing it doesn’t help. Using the Taskkill command is an easy way to do this.
How to kill Chrome browser using CMD:
Taskkill /F /IM Chrome.exe
Use the command line to kill Chromedirver:
Taskkill /F /IM Chromedriver.exe
In order to terminate the Firefox browser:
taskkill /F /IM firefox.exe
If your work has not yet been saved, do not kill the Microsoft Word application.
taskkill /F /IM WinWord.exe
It might sometimes not be possible to interact with the command window itself. The process can be re-started by opening a new command window and closing all previous ones.
taskkill /F /IM cmd.exe
Even the current command window in which the command has been triggered will be killed.
You may also other Command lines: Windows Copy Command Syntax & Examples [CMD]
Last Updated on 7 months by Max