Powershell provides command Stop-Process
to kill a process from command prompt. This command can take in process Id, process name etc and can kill process from CMD.
Powershell command to Kill a process using name
Below is an example command to kill a process using name of the application or image file.
Stop-Process -Name ApplicationName
For example, to kill chrome application using powershell
Stop-process -Name Chrome
Note that this command does not ask for confirmation and straight away kill the running process. If the application is running multiple instances on the computer(For example, multiple firefox windows) it kills each of those processes. If you would like to kill a specific instance, you should use processId argument with Stop-Process
command.
Powershell command to kill a process using Id
Stop-process -Id processId
Example:
Below are sequence of commands showing Stop-process killing a specific CMD process.
PS C:\> tasklist | findstr /C:cmd cmd.exe 7628 Console 1 4,444 K cmd.exe 9640 Console 1 3,512 K cmd.exe 9352 Console 1 3,564 K PS C:\> stop-process -Id 7628 PS C:\> tasklist | findstr /C:cmd cmd.exe 9640 Console 1 3,512 K cmd.exe 9352 Console 1 3,564 K
More examples
Kill all CMD processes running on the computer
Stop-Process -name CMD
Kill windows explorer
Stop-Process -name explorer
Kill putty sessions
stop-process -name putty
get-process cmd -ea 0 | stop-process
This page solved my problem exactly! so so good! thank you!!!
How can I do it remotely?