I try to make a menu with choice
errorlevel is always empty
This should be working but it is not
I tried using the keypad, or the num keys under functions keys, ERRRORLEVEL IS NEVER SET
@echo off
cls
choice /c123 /n "Select an option:"
echo Selected option: %ERRORLEVEL%
if %ERRORLEVEL%==1 (
echo "launching casino games"
rem mount a: W:\GAMES\Poker\CasinoGames
rem a:
rem runme.bat
goto end
)
if %ERRORLEVEL%==2 (
echo "launching Ante Up"
rem mount a: W:\GAMES\Poker\Ante-Upa
rem a:
rem FNPC.EXE
goto end
)
if %ERRORLEVEL%==3 (
echo "launching Lode Runner"
rem mount a: W:\GAMES\RETRO\DOS\abandonware\LODERUN
rem a:
rem jouer.bat
goto end
)
Thanks for your help
It looks like you need to separate your choices from the /C
option by either a colon or a space. In your case you have neither. (from https://ss64.com/nt/choice.html).
It also looks like you need to specify the /M
for a custom message.
I don’t have a command prompt to hand to test but your line should probably be
choice /c:123 /n /m "Select an option:"