Bitcoin Forum

Other => Beginners & Help => Topic started by: DrFred on May 17, 2012, 04:09:57 PM



Title: Batch file help
Post by: DrFred on May 17, 2012, 04:09:57 PM
Hi, I've been using a few batch files to manage my mining and I decided to combine them all into one. I produced this

@echo off
title CGMiner
cd cgminer
CHOICE /M "Full power? y/n"
IF ERRORLEVEL 2 SET POWER=low
IF ERRORLEVER 1 SET POWER=high
:START
cd ../lite
CHOICE /M "Litecoin mining? y/n"
IF ERRORLEVEL 2 GOTO NEXT
IF ERRORLEVEL 1 start /AFFINITY 0x0E minerd -t 3 -O DrFred.1:x -o http://miningpool.com:9350
:NEXT
cd ../cgminer
start /AFFINITY 0x01 cgminer.exe -c %POWER%.conf
PAUSE
start /AFFINITY 0x01 cgminer.exe -c reset.conf

However, this doesn't work %POWER% is set to high regardless of what I press, I think it has something to do with the SET command returning it's own errorlevel. Could anyone point out what I'm doing wrong?


I managed to get it almost working how I wanted by changing the code to the following but now the "GOTO HIGH" bit doesn't work (returns 1 was unexpected). (Edit: fixed a typo, now working, but I'd still like it using the set command if possible)

@echo off
title CGMiner
cd cgminer
CHOICE /M "Full power? y/n"
IF ERRORLEVEL 2 GOTO LOW
IF ERRORLEVEL 1 GOTO HIGH
:START
cd ../lite
CHOICE /M "Litecoin mining? y/n"
IF ERRORLEVEL 2 GOTO NEXT
IF ERRORLEVEL 1 start /AFFINITY 0x0E minerd -t 3 -O DrFred.1:x -o http://miningpool.com:9350
:NEXT
cd ../cgminer
start /AFFINITY 0x01 cgminer.exe -c %POWER%.conf
PAUSE
start /AFFINITY 0x01 cgminer.exe -c reset.conf
GOTO END
:LOW
SET POWER=low
GOTO START
:HIGH
SET POWER=high
GOTO START
:END