简体   繁体   English

无法使用 powershell 终止进程(停止进程)

[英]Cannot kill process with powershell (Stop-Process)

I have a ps1 script (Windows 2008 R2) to kill process:我有一个 ps1 脚本(Windows 2008 R2)来终止进程:

 Stop-Process -Name "c_proc".

c_proc is a program that runs in console mode. c_proc 是一个以控制台模式运行的程序。 After running this script c_proc does not exit, it just keeps restarting in console mode.运行此脚本后, c_proc不会退出,它只是在控制台模式下不断重启。 Another way to kill c_proc is to kill conhost.exe but it didn't work either.另一种杀死c_proc是杀死 conhost.exe,但它也不起作用。 c_proc can exit when you type in its console windows "exit".当您在其控制台窗口中键入“exit”时, c_proc可以退出。 How can I send the message "exit" to the console window via PowerShell or cmd?如何通过 PowerShell 或 cmd 将消息“退出”发送到控制台窗口? How can I kill c_proc ?我怎样才能杀死c_proc

This is the right code to kill the process c_proc .这是杀死进程c_proc的正确代码。 I found the parent process:我找到了父进程:

  Stop-Process -Name "start"
  Stop-Process -Name "c_proc"

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

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