Created
July 26, 2018 07:38
-
-
Save dnaga392/1cfcbe91c0b0dff2d9590853440dc321 to your computer and use it in GitHub Desktop.
(Batch) question batch file with default answer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal | |
:QUESTION | |
set answer= | |
set /p answer="Will you execute it? ([y]/n) : %answer%" | |
if "%answer%"=="" ( | |
echo "default start" | |
) else if "%answer%"=="y" ( | |
echo "start" | |
) else if "%answer%"=="n" ( | |
echo "cancel" | |
exit /b 1 | |
)else ( | |
echo "other key" | |
goto QUESTION | |
) | |
endlocal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment