better batch log in help
sorry if this sounds bumb but i was trying to make a batch log in file which needs both a username and password but it didnt work this is what i had,
@echo off color 1B ::find "username" userthenpass.bat | sort goto username :start SET /P prompt=Please enter your username: ECHO. IF /I '%prompt%'=='%username%' GOTO solution cls echo that is not a registered username Pause cls goto start exit :username SET username= hello goto start :solution cls echo welcome hello, please put in your password before you can continue
::find "password" userthenpass.bat | sort goto password :start SET /P prompt=Please enter your password: ECHO. IF /I '%prompt%'=='%password%' GOTO solution cls echo wrong password Pause cls goto start exit :password SET password= hello goto start :solution cls echo welcome hello, you are now sucsessfuly logged in!
any help would be greatly appreciated.
MaW wrote: sorry if this sounds bumb but i was trying to make a batch log in file which needs both a username and password but it didnt work this is what i had,
@echo off color 1B ::find "username" userthenpass.bat | sort goto username :start SET /P prompt=Please enter your username: ECHO. IF /I '%prompt%'=='%username%' GOTO solution cls echo that is not a registered username Pause cls goto start exit :username SET username= hello goto start :solution cls echo welcome hello, please put in your password before you can continue
::find "password" userthenpass.bat | sort goto password :start SET /P prompt=Please enter your password: ECHO. IF /I '%prompt%'=='%password%' GOTO solution cls echo wrong password Pause cls goto start exit :password SET password= hello goto start :solution cls echo welcome hello, you are now sucsessfuly logged in!
any help would be greatly appreciated.
My advise - Batch doesnt do too well for a password login. People just right-click then click edit and they can see whats inside. Number 2 - Find doesnt work very well anymore. What you want is something like
color 4F
goto username
:start
SET /P prompt=Please enter your name:
ECHO.
IF /I '%prompt%'=='%username%' GOTO pass
cls
echo Sorry, the username you gave was incorrect!
Pause
cls
goto start
:username
SET username=hello
goto start
:pass
SET pass=pass
goto password
:password
SET /P prompt=Please enter your password:
ECHO.
IF /I '%prompt%'=='%pass%' GOTO solution
cls
echo Sorry, the password you gave was incorrect!
Pause
cls
goto start
:solution
cls
echo Correct Login and Pass
pause
cls
exit```
I tried this and it works. Build off of this. (sorry for butchering your code, S_M, But I had to for the sake of my sanity)
Bl4ckC4t