Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I kill a process in Powershell

Say I'm running a python script that doesn't exit properly. The powershell console does not return control to me without having to close the shell and open a new one. With Bash I can simply press Control-C to kill any process. What am I missing here?

Windows 8.1 Powershell

like image 720
zachleedogg Avatar asked Dec 23 '22 22:12

zachleedogg


2 Answers

To kill a process, you can use the command Stop-Process.

Or you can try Ctrl + Break shortcut.

like image 79
bluray Avatar answered Jan 14 '23 08:01

bluray


Use the following stop-service <service> choose a flag like -force to force stop even if it has dependent services as well.

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/stop-service?view=powershell-5.1

like image 20
Peter Girnus Avatar answered Jan 14 '23 07:01

Peter Girnus