control amount of loops (batch file) -
i wondering if there way put limit on loop batch file. mean this: have script:
@echo off :start echo enter password set /p password= if %password%== abcdefg goto correct if not %password%== abcdefg goto start :correct echo job timeout 2 > nul exit :wrong echo wrong timeout 1 > nul exit
say wanted go through start 3 times, , after that, go wrong. how that?
@echo off setlocal enabledelayedexpansion /l %%a in (1, 1, 3) ( set /p "password=enter password: " if "!password!"=="abcdefg" goto :correct echo wrong, try again timeout /t 1 >nul ) exit :correct echo job timeout /t 2 > nul exit
Comments
Post a Comment