Generate password with minimum and maximum length : batch file : <p>Trying to generate password with given characters but need to define minimum and maximum password string length inside batch file.</p>

<p>i created batch file which is generating password string perfectly but i was unable to define length of string in Min_RNDLength &amp; Max_RNDLength field.</p>

<pre><code>@Echo Off
Setlocal EnableDelayedExpansion
Set Min_RNDLength=8
Set Max_RNDLength=30
Set _Alphanumeric=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
Set _Str=%_Alphanumeric%987654321
:_LenLoop
IF NOT "%_Str:~18%"=="" SET _Str=%_Str:~9%&amp; SET /A _Len+=9&amp; 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 Random string is !_RndAlphaNum!
</code></pre>

<p>not sure how to overcome this issue.</p>
