I have a batch script that generates a random 75 digit long password string. When the password string starts with a 0
value other parts of automation I setup become unstable. I need a way to identify when the very first digit in the random password string is a zero.
My plan will be to reject the string if the first character of it is a 0
and generate a new password.
Note: I found a couple solutions but both were for small strings way less than 75 digits.
Batch File
@Echo off&SetLocal EnableExtensions EnableDelayedExpansion
set execute counter=0
:loop
Set "Chars=1234567890"
Set CharsCnt=10
Set "Pass="
For /L %%c in (1,1,75) do (
Set /a Pnt=!Random! %% CharsCnt
Call Set "Pass=!Pass!%%Chars:~!Pnt!,1%%"
)
Echo Password is:%Pass%
start "" https://check.pass/%pass%
goto loop
Output
Without leading
0
115792089237316195423570985008687907852837564279074904382605163141518161495
With a leading
0
(automation becomes unstable)011579208923731619542357098500868790785283756427907490438260516314151816149