3

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

Claus
  • 5,662
  • 10
  • 77
  • 118

4 Answers4

3

You can try with :

TASKKILL /F /IM "notepad.exe"

You can know more here. Visit this blog too.

Venkat
  • 2,604
  • 6
  • 26
  • 36
  • The link details for "here" and "this blog" are dead links. So we get an answer that looks the same as the question, with no explanation for why it's the correct answer or what it does. – John Rocha Apr 17 '20 at 17:18
1

Why don't you use PowerShell?

Stop-Process -Name java.exe

From the old command prompt:

powershell -Command "Stop-Process -Name java.exe"
Rosberg Linhares
  • 3,537
  • 1
  • 32
  • 35
0

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

Community
  • 1
  • 1
LCJ
  • 22,196
  • 67
  • 260
  • 418
0

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>
Sireesh Yarlagadda
  • 12,978
  • 3
  • 74
  • 76