Kill Process from command line | Windows 10 | 7 | Server 2016 | 2012 using the tasklist command, this article explains command usage and it’s parametors.
There are two ways one can kill any process, the first method using task manager and the second method using taskkill command, let’s discuss both methods and one can choose as per the need.
well, we need to list out all processes that are running on the computer, we have a command tasklist to list out all the processes, here is the output looks when you run it.
C:\Users\Raj>tasklist Image Name PID Session Name Session# Mem Usage ========================= ======== ================ =========== ============ System Idle Process 0 Services 0 8 K System 4 Services 0 32 K Registry 96 Services 0 48,768 K smss.exe 404 Services 0 548 K csrss.exe 612 Services 0 2,160 K wininit.exe 696 Services 0 2,468 K
I have listed the first 6 processes among all, well let’s kill a process using Taskkill.
Taskkill using the image name
taskkill /IM firefox
above command kills the firefox browser make sure you have saved before you kill it.
C:\Users\Raj>taskkill /IM mspaint.exe SUCCESS: Sent termination signal to the process “mspaint.exe” with PID 6116.
Kill process forcefully using /F switch
There are some situations when you kill a process it doesn’t go away, due to multiple processes running behind it, so we have to use a switch called taskkill /F, the below examples explain it.
C:\Users\Raj>taskkill /F /IM firefox.exe SUCCESS: The process "firefox.exe" with PID 3316 has been terminated. SUCCESS: The process "firefox.exe" with PID 8792 has been terminated. C:\Users\Raj>
Kill process using process ID.
taskkill /PID processId
taskkill /PID 1002 SUCCESS: The process "firefox.exe" with PID 3316 has been terminated. SUCCESS: The process "firefox.exe" with PID 8792 has been terminated
taskkill /F /IM cmd.exe
taskkill /F /IM winword.exe
taskkill /F /IM excel.exe
This GUI method, you can open task manager by right-clicking on taskbar and then click on task manager to open it, under process tab you can find process that you want to kill, then right click on that process and choose an end option to kill the process, please the screenshot below.
Thank you for reading this article, if you have any questions please let us know.
Thank you for visiting my site, for any scripts in these articles you are testing please make sure you have tested this script in our lower environment before you run in production.