Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Simple batch file related to Steam

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%'=='.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading