You always want to stop a process gracefully. However, sometimes it’s just not possible to do so. Sometimes, you have to kill a process. Sometimes you have to end a process or a process tree when you can’t restart them gracefully.
To stop a process in Linux and Mac, use the kill command. In Windows, there’s a Powershell cmdlet called Stop-Process that enables you to terminate a process. As with kill, just add the process ID at the end of the command. For example, to stop process 318:
Or you can stop based on the name of the process using the -processname option. For example, to kill a process called minesweeper:
Stop-Process -processname minesweeper
Note: You can include wildcards in these commands as well.
Be careful what you wish for. The reason you’d kill a process rather than reboot is that you don’t want to reboot because other processes are working out just fine. You can always kill a process, but some will reboot your boxen.
Finally, there’s also taskkill.exe, which can be used as well:
taskkill.exe /F /IM minesweeper.exe /T
krypted February 6th, 2014
Posted In: Active Directory, Microsoft Exchange Server, Windows Server, Windows XP
end a process by id, kill, killall, process trees, terminate processes, windows