I want a way of running and checking two of the same application.exe’s using two different bat scripts in case they crash, in order to do this, I need to check each one individually based on the path the .exe came from.
So my current code looks like this:
tasklist /FI "IMAGENAME eq TimeLoopServer.exe" 2>NUL | find /I /N "TimeLoopServer.exe">NUL if "%ERRORLEVEL%"=="0" goto :PULSE
And this worked great, it would detect if it was running in windows and if not it would reboot.
But now I want to run a second instance from a different directory.
So my thinking is I can set the directories like this:
tasklist /FI "IMAGENAME eq C:ServerOneTimeLoopServer.exe" 2>NUL | find /I /N "C:ServerOneTimeLoopServer.exe">NUL if "%ERRORLEVEL%"=="0" goto :PULSE
But this doesn’t seem to detect the pathed executable.
Is there a better way to tackle this? The applications will look the same in the Task Manager and the only difference is where the file was launched from.