I’m trying to customise a bit, already made very basic batch file, made purely for fun, who’s purpose is to change your Steam client statuses.
The original file is here, and it works just fine.
However, I wanted to use if errorlevel, instead of his if '%choice%'=='.
Obviously I can’t make it work, and would appreciate it, if someone can assist me.
if errorlevel is way better, in my oppion, because instantly goes to your selected choice, also has cool BEEP sound every time you press unassigned key / make unavailable choice.
I tried like this, but it isn’t working, batch file simply closes it self, and doesn’t execute a task.
choice /c:12345678 /n > nul
if errorlevel 8 goto EXIT
if errorlevel 7 goto OFFLINE
if errorlevel 6 goto BUSY
if errorlevel 5 goto LOOKING TO PLAY
if errorlevel 4 goto LOOKING TO TRADE
if errorlevel 3 goto AWAY
if errorlevel 2 goto INVISIBLE
if errorlevel 1 goto ONLINE
>Solution :
The problem is likely elsewhere in your code, because this works as expected:
@echo off
choice /c:123 /n > nul
if errorlevel 3 goto EXIT
if errorlevel 2 goto OFFLINE
if errorlevel 1 goto BUSY
echo Someone hit Ctrl-break and continued
goto EXIT
:OFFLINE
echo OFFLINE
goto EXIT
:BUSY
echo BUSY
goto EXIT
:EXIT