-1

I was playing around with batch scripts on windows and I was trying to make a basic password generator.

( Maximum setlocal recursion level reached. )

My code :

@Echo Off
color 0a
set /P lengthnumberuser="What length do you want your password to be?   "
pause
cls

:code
Setlocal EnableDelayedExpansion
set _RNDLength=16
set _Alphanumeric=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
set _Str=%_Alphanumeric%987654321
:_LenLoop
if NOT "%_Str:~18%"=="" SET _Str=%_Str:~9%& SET /A _Len+=9& GOTO :_LenLoop
set _tmp=%_Str:~9,1%
set /A _Len=_Len+_tmp
set _count=0
sET _RndAlphaNum=
:_loop
set /a _count+=1
sET _RND=%Random%
set /A _RND=_RND%%%_Len%
sET _RndAlphaNum=!_RndAlphaNum!!_Alphanumeric:~%_RND%,1!
if !_count! lss %_RNDLength% goto _loop
echo !_RndAlphaNum!
goto code
pause
txreqb2w
  • 1
  • 1
  • 1
    move `setlocal enabledelayedexpansion` out of the loop (best place would be as second line, right after `@echo off`) – Stephan Jun 30 '20 at 08:38

1 Answers1

1

Just delete the goto code at the end of the your code.

See Here : Link