I am in need of help to adding a not responding check to my .bat and restarting a server application when it is not responding. This is what I have so far.
@echo on
tasklist /nh /fi "imagename eq javaw.exe" | find /i "javaw.exe" >nul && (
echo Server is running.
//
I need a not responding check right afterward here. If the program is not responding,
taskkill /f /IM server.exe
taskkill /f /IM javaw.exe
cd C:\Users\Administrator\Desktop
serverstart.jar
else
exit
//
exit
) || (
echo Server process not found.
taskkill /f /IM server.exe
taskkill /f /IM javaw.exe
cd C:\Users\Administrator\Desktop
serverstart.jar
)
pause>nul
It is necessary for me to kill both of these process because it doesn't end eachother when it crashes apparently.
You already managed to filter by imagename. You can also filter by Status (Running / Not Responding / Unknown):
will give you any java.exe, which does not respond.
EDIT
well - when I think about it: I would try: