Here is my code, I don't want the user to have to press enter to make a choice. I tried a couple of things but nothing I tried worked.
@echo off
:debut mon menu a moi
cls
echo 1.Calculatrice
echo 2.Task manager
echo 3.msconfig
echo 4.Notepad
echo 5.ipconfig
echo 6.quit
echo.
set /p /c choix=" Choisir votre application : "
if "%choix%"=="1" goto menu1
if "%choix%"=="2" goto menu2
if "%choix%"=="3" goto menu3
if "%choix%"=="4" goto menu4
if "%choix%"=="5" goto menu5
if "%choix%"=="6" goto menu6
I didn't include the menu since it's not relevant
The
choice
command returns an errorlevel value between 1 and 6 (or 0 if the user press Ctrl-C), sogoto menu%errorlevel%
command direclty transfer to the desired label without need of any additional checking. For further details, type:choice /?