if statement not working batch (goes directly to else) -
i'm working on password batch file;but, if statement not working. when ask check whether password correct, goes else statement, if correctly enter password (hi). here part of code has problem:
if "%r%"=="hi" ( goto b ) else ( echo access denied. goto f )
and here entire code:
echo off color 0f pause :f set /p r = "please enter passcode " if "%r%"=="hi" ( goto b ) else ( echo access denied. goto f ) :a /l %%a in (1,1,234) ( color 6e echo %random%%random%%random%%random%%random%%random%%random% color 2a echo %random%%random%%random%%random%%random%%random%%random%%random% color 1b echo %random%%random%%random%%random%%random%%random%%random%%random% color 5d echo %random%%random%%random%%random%%random%%random%%random%%random% color 4c echo %random%%random%%random%%random%%random%%random%%random%%random% ) goto c :b echo welcome pause >nul echo current computer not contain previous files. pause >nul echo download backup files now? pause >nul echo downloading files... goto :c echo access granted. welcome cia mainframe. pause >nul echo please se-se-select c-command. pause >nul echo alert! alert! main fire wall has been breached! pause >nul echo files being deleted now... pause >nul :d color 0c echo %random%%random%%random%%random%%random%%random%%random% echo %random%%random%%random%%random%%random%%random%%random%%random% echo %random%%random%%random%%random%%random%%random%%random%%random% echo %random%%random%%random%%random%%random%%random%%random%%random% echo %random%%random%%random%%random%%random%%random%%random%%random% goto d
can please help.
this problem spaces in variable.
try command line:
>set /p r = "please enter passcode: " please enter passcode: blah >echo %r% %r% >echo %r % blah
change line to:
set /p "r=please enter passcode: "
and should fix.
Comments
Post a Comment