Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

This requires end user press "Enter" key after input and utilizes "set /P":

@echo off
:Ask
set INPUT=
set /P INPUT=Enter Y or N?: %=%
If /I "%INPUT%"=="y" goto yes 
If /I "%INPUT%"=="n" goto no
echo Incorrect input & goto Ask
:yes
echo YES!
pause
goto exit
:no
echo NO!
pause
goto exit
:exit
echo exit!
pause

This automatically takes user input without need to hit enter key and utilizes "CHOICE":

@ECHO OFF
set errorlevel=-1
CHOICE
IF ERRORLEVEL ==2 goto 2
IF ERRORLEVEL ==1 goto 1
goto end
:1 
echo Y
pause
goto end
:2 
echo N
pause
goto end
:end
echo end
pause
  • No labels

1 Comment