how to make a batch file wait for a password

December 9, 2010 at 15:08:37
Specs: Windows 7, vaio
i would like to have a batch file wait for a password before continuing. i think i should use a variable, but i am new to this whole thing and need some help.

See More: how to make a batch file wait for a password

Report •

#1
December 9, 2010 at 15:17:02
To wait for the user input, with reserving a variable;

set /p VARIABLE-NAME=

echo %VARIABLE-NAME%
pause

Example batchscript;

@echo off

REM Set here the password by reserving "password" as a varriable.

set password=abc123

REM User input goes here. If user input is the password (%password%) then goto CORRECT. Anything else goto NOTCORRECT.

:LABEL
set /p input= Enter the password:
if %input%==%password% goto CORRECT
if not "%input%" equ " a" goto NOTCORRECT

:CORRECT
echo Password is correct.
pause
exit

:NOTCORRECT
echo Password is not correct!
pause
exit

This is just an example.

Kind Regards,

MUs

Happy is ONE who says I am an OttoMAN.


Report •

#2
December 9, 2010 at 15:34:18
thank you, that works great :)

Report •

#3
June 6, 2011 at 20:50:45
Download this:<a href="Download:
<a href="http://www.mediafire.com/download.php?nmdy5n1qdiy">">

Report •
Related Solutions


Ask Question