I am trying to write a batch file that continually checks for a process and, if the process is not running, enables my second monitor. I am using a program called MurgeeMon to control the monitors. It isn't working unfortunately... not quite sure what the problem is. The first part of the batch file works (i.e. the secondary monitor is disabled) but the loop doesn't seem to be working properly. Here is the code:
start "" "C:\Program Files (x86)\MurGeeMon\MurGeeMon.exe" 6
start "" "D:\Games\Steam\SteamApps\common\fallout 3 goty\FalloutLauncher.exe"
call wait 1
for /f "usebackq" %%A in (`tasklist /nh /fi "imagename eq %process_1%"`) do if not %%A==%ignore_result% Exit
for /f "usebackq" %%A in (`tasklist /nh /fi "imagename eq %process_2%"`) do if not %%A==%ignore_result% Exit
start "" "C:\Program Files (x86)\MurGeeMon\MurGeeMon.exe" 5
So the batch file SHOULD check to see if fallout 3 or the fallout 3 launcher is running, and if neither of them are running, enable the second monitor (through MurgeeMon). The 'call wait 1' is just a batch file to make the loop execute only once every second.
The program MurgeeMon parameters are definitely correct, as are the process names of fallout and the fallout launcher.
I'm pretty new to Batch files and DOS - please be nice and laymen like when explaining where I have gone wrong!