Title: Late windows DOS batch file logic question...
Post by: JaredKaragen on May 17, 2016, 12:35:37 AM
So I am working on an upgrade idea for my GPU miner's batch file.
There has to be a way to check if an app is running through the terminal window and use it with logic in a batch file.
such as:
:beginfile start ccminer.exe --options :memoryloop <check for ccminer.exe in memory> true, wait x time and goto memoryloop false, goto beginfile
Any ideas guys? Probably going to have to define a variable for the true/false?
I never learned the advanced windows-connected DOS commands...
Title: Re: Late windows DOS batch file logic question...
Post by: JaredKaragen on May 17, 2016, 01:07:07 AM
:wait1 set EXE=ccminer.exe FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %EXE%"') DO IF %%x == %EXE% goto FOUND goto FIN1 :FOUND echo %EXE% still running. goto wait1 :FIN1 :wait2 set EXE=ccminer_.exe FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %EXE%"') DO IF %%x == %EXE% goto FOUND goto FIN2 :FOUND echo %EXE% still running. goto wait2 :FIN2 :wait3 set EXE=ccminer50.exe FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %EXE%"') DO IF %%x == %EXE% goto FOUND goto FIN3 :FOUND echo %EXE% still running. goto wait3 :FIN3 :wait4 set EXE=ccminer-DCD.exe FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %EXE%"') DO IF %%x == %EXE% goto FOUND goto FIN4 :FOUND echo %EXE% still running. goto wait4 :FIN4 :wait5 set EXE=ccminerB2S64.exe FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %EXE%"') DO IF %%x == %EXE% goto FOUND goto FIN5 :FOUND echo %EXE% still running. goto wait5 :FIN5 goto start
|