@echo off
:loop
choice/c:abce
if errorlevel 4 goto end
if errorlevel 3 goto c
if errorlevel 2 goto b
if errorlevel 1 goto a
goto loop
:a
@echo aaaaa
goto loop
:b
@echo bbbbb
goto loop
:c
@echo ccccc
goto loop
:end
Performs conditional processing in batch programs.
IF [NOT] ERRORLEVEL number command
IF [NOT] string1==string2 command
IF [NOT] EXIST filename command
NOT Specifies that Windows should carry out the command only
if the condition is false.
ERRORLEVEL number Specifies a true condition if the last program run returned
an exit code equal to or greater than the number specified.
command Specifies the command to carry out if the condition is
met.
string1==string2 Specifies a true condition if the specified text strings
match.
EXIST filename Specifies a true condition if the specified filename
exists.
@echo off
:loop
choice/c:abce
if errorlevel 4 goto end
if errorlevel 3 goto c
if errorlevel 2 goto b
if errorlevel 1 goto a
goto loop
:a
@echo aaaaa
goto loop
:b
@echo bbbbb
goto loop
:c
@echo ccccc
goto loop
:end