Use TASKLIST and TASKKILL : Good web site on this http://commandwindows.com/taskkill.htm
(F)orce Kill running processes for ImageName of java.exe
taskkill.exe /F /IM java.exe
NOTE: Wildcard ‘*’ for the /IM switch is accepted only with filters, use /FI
taskkill /F /FI “IMAGENAME eq note*”
Find all running Java processes command line
tasklist /FI “IMAGENAME eq java.exe”
Example: I started 2 Calculator programs.
H:\>tasklist /FI “IMAGENAME eq calc*”
Image Name PID Session Name Session# Mem Usage ========================= ====== ================ ======== ============ calc.exe 4652 Console 0 3,420 K calc.exe 1936 Console 0 3,412 K
H:\>taskkill /F /FI “IMAGENAME eq calc*”
SUCCESS: The process with PID 4652 has been terminated.
SUCCESS: The process with PID 1936 has been terminated.
I needed these commands to script a nightly restart of a java application that had a bad memory leak. For some reason the normal stop wasn’t working. ![]()
