Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I write a batch file script which will kill the java.exe process? I intend to run it from the Windows Task Scheduler.


share|improve this question
what version of windows are you using? – Zack T. Mar 15 '13 at 15:13
google "schedule a batch file" and it gives plenty of options for finding out how. You could even append your version of windows, whether it is Windows XP, Windows 7, or Windows 8 and get results specific to your OS. – Zack T. Mar 15 '13 at 15:17
taskkill.exe /IM java.exe

or if you want to force the process to exit use:

taskkill.exe /F /IM java.exe
share|improve this answer
Can you please little bit more elaborate how i make it in notepad bat job and then run it in task schedule. – user207463 Mar 15 '13 at 13:14

It needs to follow this implementation

taskkill /F (force) /IM (the next value is the imageName) programName.exe (and the image name!)

So I would use

taskkill /F /IM java.exe

More reading

share|improve this answer
+1 for posting this faster than me ;) – weberik Mar 15 '13 at 13:09
only by 16 seconds! – Dave Mar 15 '13 at 13:09
Thank you for your quick reply. so its mean i should copy the exect lines. (taskkill /F /IM java.exe) and save the notepad file with kill.bat and then run it through task schedule .it will run ? – user207463 Mar 15 '13 at 13:11
yes. either place it in a batch file (using notepad as you described) or directly execute the command from the taskscheduler – weberik Mar 15 '13 at 13:41

Another possibility:

wmic process where name="java.exe" delete


tskill java /a
share|improve this answer
kindly note that i need a BATCH job file which i will run through Task Schedule. How can i do that ? – user207463 Mar 15 '13 at 13:18
kindly note that there are HUNDREDS of tutorials for writing batch files. Here's a quick one: 1) Open Notepad. 2) Paste the line taskkill /f /im java.exe to Notepad. 3) Save the file as "kill-java.cmd". – grawity Mar 15 '13 at 15:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.