Answer» I am TRYING to make get a user to log in, to use the batch script, but the login is failing in the second FOR loop...
Here is my code. List.txt is a file with about 30 lines, each different. The first word is a possible username, the second a possible password. No usernames are the same.
Code: [Select]@echo off setlocal enabledelayedexpansion set fname=list.txt :looplog set num1=0 set num2=0 echo ENTER your username. set /p USR=Username^: Echo Enter your password. set /p PASS=Password^: pause for /f "delims=" %%z in ('type %fname%') do ( set /a num1+=1 ) echo Lines^: %num1% pause for /f "tokens=1-2 delims= " %%a in ('type %fname%') do ( if "%%a"=="%usr" if "%%b"=="%pass%" goto cont set /a num2+=1 if %num2%==%num1% CLS & echo Username and/or password don't match. & goto looplog ) :cont echo HI! pause For some reason, the second FOR loop is not LOOPING...so it just keeps on going as if it didn't exist...
if "%%a"=="%usr" if "%%b"=="%pass%" goto contQuote from: Geek-9pm on April 19, 2009, 07:43:35 PM if "%%a"=="%usr" if "%%b"=="%pass%" goto cont
I did not see that...
|