开发者

Killing a process with taskkill /F returning code 0

I need to kill a windows process (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)

how开发者_运维百科 could I fix this problem?

Many thanks


You can try with :

TASKKILL /F /IM "notepad.exe"

You can know more here. Visit this blog too.


Why don't you use PowerShell?

Stop-Process -Name java.exe

From the old command prompt:

powershell -Command "Stop-Process -Name java.exe"


I am using following command on Windows Server 2008R2

Taskkill /IM B2B_Crawler_V2.exe /F

Refer Taskkill and Killing a process in Batch and reporting on success


Execute this in 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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜