[英]Killing a process with taskkill /F returning code 0
I need to kill a windows process (java.exe). 我需要杀死Windows进程(java.exe)。 I'm currently using: 我目前正在使用:
taskkill.exe /F /IM java.exe
I need to use the /F option since is a critical process,but in this way I get a return code 1 instead I need a return code 0 (returned when I don't use /F for killing other not critical processes) 我需要使用/ F选项,因为这是关键过程,但是通过这种方式,我得到的是返回码1,而我需要返回代码0(当我不使用/ F杀死其他非关键过程时返回)
how could I fix this problem? 我该如何解决这个问题?
Many thanks 非常感谢
Why don't you use PowerShell? 您为什么不使用PowerShell?
Stop-Process -Name java.exe
From the old command prompt: 在旧的命令提示符下:
powershell -Command "Stop-Process -Name java.exe"
Execute this in CMD 在CMD中执行
Get the list of open processes 获取打开的进程列表
netstat -a -o -n
And then kill the process on that port with the following command 然后使用以下命令终止该端口上的进程
taskkill /F /PID <pid>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.