How to detect invalid user input in a Batch File?
Posted
by
user2975367
on Stack Overflow
See other posts from Stack Overflow
or by user2975367
Published on 2013-11-10T03:18:49Z
Indexed on
2013/11/10
3:53 UTC
Read the original article
Hit count: 157
batch-file
I want to use a batch file to ask for a password to continue, i have very simple code that works.
@echo off
:Begin
cls
echo.
echo Enter Password
set /p pass=
if %pass%==Password goto Start
:Start
cls
echo What would you like me to do? (Date/Chrome/Lock/Shutdown/Close)
set /p task=
if %task%==Date goto Task=Date
if %task%==Chrome goto Task=Chrome
if %task%==Lock goto Task=Lock
if %task%==Shutdown goto Task=Shutdown
if %task%==Close goto Task=Close
I need to detect when the user entered an invalid password, i have spent an hour researching but i found nothing. I'm not advanced in any way so try and keep it very simple like the code above.
Please help me.
© Stack Overflow or respective owner