简体   繁体   English

如何在Powershell中终止进程

[英]How do I kill a process in Powershell

Say I'm running a python script that doesn't exit properly. 假设我正在运行一个无法正常退出的python脚本。 The powershell console does not return control to me without having to close the shell and open a new one. powershell控制台不会将控制权返回给我,无需关闭shell并打开一个新的。 With Bash I can simply press Control-C to kill any process. 使用Bash我可以简单地按Control-C来杀死任何进程。 What am I missing here? 我在这里错过了什么?

Windows 8.1 Powershell Windows 8.1 Powershell

You can use for kill process command stop-process . 您可以使用kill process命令stop-process Or you can try Ctrl+Break shortcut. 或者您可以尝试Ctrl + Break快捷方式。

Use the following stop-service <service> choose a flag like -force to force stop even if it has dependent services as well. 使用以下stop-service <service>选择一个像-force这样的标志来强制停止,即使它也有依赖服务。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM