Search notes:

taskkill.exe

taskkill.exe can be used to terminate (kill) processes from within cmd.exe or PowerShell.

Specifying the image name

C:\> taskkill /im  foo.exe

Specify the PID (Process identifier)

The /pid option allows to kill a process by its process identifier.
C:\> taskkill /pid 5711
Process ids can be found with tasklist.exe.

Using /f to forcefully terminate a process

When trying to kill a process, the utility might print something like SUCCESS: Sent termination signal to the process with PID 4128. even though the process was not killed.
Therefore, in order to make sure a process is killed, the /f might be used to forcefully terminate a process:
C:\> taskkill /f /pid 5711

Using a filter on the process name

taskkill has a rudimentary filter function that can be applied with /fi which can be used to kill a process when I am not exactly sure what the name of the process is.
For example, if SQL Developer hangs, I might use
C:\> taskkill /fi "imagename eq sqldeveloper*"
SUCCESS: Sent termination signal to the process with PID 33220.
The /fi option is also present in tasklist.exe.

See also

tasklist.exe, tskill.exe
The PowerShell cmdLet stop-process.
The Linux shell command kill.
cmd.exe: Built-in commands

Index