Search code examples
windowsprocessbatch-filereturn-codetaskkill

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


Solution

  • You can try with :

    TASKKILL /F /IM "notepad.exe"
    

    You can know more here. Visit this blog too.