Kill Processes from Command Prompt

Posted by KrishKT KrishKT
Options
>> Killing processes in Command Prompt provides much more control and the ability to end multiple processes at once.

All of this is possible with the TaskKill command. You can kill a process by the process ID (PID) or by image name (EXE filename).

>> Open up an Administrative level Command Prompt and run tasklist to see all of the running processes:

C:\>tasklist
Image Name | PID Session Name | Mem Usage
----------------------------------------------------------

>> From the 'tasklist' results, you can see the image name and the PID for each process. If you want to kill a process run:

C:\>Taskkill /IM imagename1.exe /F
 or

C:\>Taskkill /PID Session# /F
The /f flag is kills the process forcefully.  Failure to use the /F flag will result in nothing happening in some cases.  One example is whenever I want to kill the explorer.exe process I have to use the /F flag or else the process just does not terminate.

If you have multiple instances of an image open such as multiple process Imagenames.exe processes, running the taskkill /IM imagename1.exe command will kill all instances. When you specify the PID only the specific instane of that respective process will be terminated.

ref.