On a Windows operating system, you normally use Task Manager to list and stop processes. However, a process can sometimes become stuck, making it necessary to kill it to force it to stop.
This article explains how to do this using CMD or PowerShell. PID 99999 will be used as the example process throughout this article. For the equivalent procedure on a Linux system, see the following article: Killing processes in Linux.
To list active processes, simply run:
# tasklist
You can find more information in the official documentation for tasklist.
You can also use WMIC to list processes with more details:
# wmic PROCESS get /all /format:LIST
You can find more information in the official documentation for wmic.
To find or check a process's path, you can query WMIC using its PID:
# wmic PROCESS where "ProcessId like 99999" get /all /format:LIST | findstr ExecutablePath
Replace 99999 with the relevant PID. To query by name, use:
# wmic PROCESS where "Name like '%ejemplo%'" get /all /format:LIST | findstr ExecutablePath
You can also list connections with netstat and identify the responsible process by its PID. To do this, run:
# netstat -ona
For more information, see the documentation for netstat.
To send a request to stop a process by PID:
# taskkill /PID 99999
For more information, see the documentation for taskkill.
The equivalent command with WMIC is:
# wmic process where ProcessID="99999" call terminate
To kill or force a process to stop by PID, add the relevant option (/F):
# taskkill /PID 99999 /F
To send a request using the process name, use:
# taskkill /IM ejemplo.exe
The equivalent command with WMIC is:
# wmic process where name="ejemplo.exe" call terminate
To list active processes, simply run:
# Get-Process
For more information, see the official documentation for Get-Process.
You can also list connections to identify the responsible process by its PID. To do this, run:
# Get-NetTCPConnection
For more information, see the official documentation for Get-NetTCPConnection.
To check a process's path using its PID, run:
# Get-Process -id 99999 -FileVersionInfo
The equivalent command using the process name is:
# Get-Process ejemplo -FileVersionInfo
To send a request to stop the process by PID/ID:
# stop-process -id 99999
For more information, see the official documentation for Stop-Process.
Finally, to kill or force a process to stop by PID/ID, add the force option:
# Stop-Process -id 99999 -force
The equivalent command using the name is:
# Stop-Process -name ejemplo -force
Remember, if you have any questions about this or anything else related to your servers on Clouding, feel free to email soporte@clouding.io We're here for whatever you need!