Skip to content

Instantly share code, notes, and snippets.

@sampollard
Created December 11, 2017 23:48
Show Gist options
  • Save sampollard/87a1bad414370047183f3f95d1b02a27 to your computer and use it in GitHub Desktop.
Save sampollard/87a1bad414370047183f3f95d1b02a27 to your computer and use it in GitHub Desktop.
Ensure exactly one or two programs is running in Windows. Useful if you only want your miner to run while you're not gaming.
REM Miner.
REM !!!! NOTE: You should edit the 'start' command to restart whichever process you want. !!!!
SET MINER=EthDcrMiner64.exe
REM Examples for a particular games, or you can just use Steam in general.
SET GAME=Dota2.exe
REM SET GAME=Steam.exe
REM Testing with echoes
:whiletrue
tasklist /FI "IMAGENAME eq %GAME%" 2>NUL | find /I /N "%GAME%">NUL
SET GAMING=%ERRORLEVEL%
tasklist /FI "IMAGENAME eq %MINER%" 2>NUL | find /I /N "%MINER%">NUL
SET MINING=%ERRORLEVEL%
if "%GAMING%"=="0" (
IF "%MINING%"=="0" (
echo "%GAME% and %MINER% running, killing %MINER%"
taskkill /im "%MINER%"
) ELSE (
echo "%GAME% running and %MINER% not running, doing nothing"
)
) ELSE (
IF "%MINING%"=="0" (
echo "%GAME% not running and %MINER% running; doing nothing"
) ELSE (
echo "%GAME% not running and %MINER% not running; restarting miner"
start C:\Users\polla\Documents\Programs\Claymore.s.Dual.Ethereum.Decred_Siacoin_Lbry_Pascal.AMD.NVIDIA.GPU.Miner.v10.0\EthDcrMiner64.exe C:\Users\polla\Documents\Programs\Claymore.s.Dual.Ethereum.Decred_Siacoin_Lbry_Pascal.AMD.NVIDIA.GPU.Miner.v10.0\config.txt
)
)
timeout /t 4
goto whiletrue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment