Q:

control amount of loops (batch file)

I am wondering if there is a way to put a limit on a loop for a batch file.
What I mean is this:   say I have a script:
@echo off
:start
echo Enter the password
set /p password=
if %password%== abcdefg goto correct
if not %password%== abcdefg goto start
:correct
echo good job
timeout 2 > nul
exit
:wrong
echo You are wrong
timeout 1 > nul
exit

say I wanted you to go through start three times, and after that, you go to wrong.  How would I do that?

A:

@echo off
setlocal enabledelayedexpansion
for /L %%a in (1, 1, 3) do (
set /p "password=Enter the password: "
if "!password!"=="abcdefg" goto :correct
echo You are wrong, try again
timeout /t 1 >nul
)
exit
:correct
echo good job
timeout /t 2 > nul
exit

