I am trying to create a random password using batch.
I googled and found a method but it involves setlocal delayed exapansion and all which is affecting my existing code (with special characters and stuff)
This is the code I got:
IF NOT "%_Str:~18%"=="" SET _Str=%_Str:~9%& SET /A _Len+=9& GOTO :_LenLoop
SET /A _Len=_Len+_tmp
Set /a _count+=1
Set /A _RND=_RND%%%_Len%
If !_count! lss %_RNDLength% goto _loop
Echo Random string is !_RndAlphaNum!
However I dont know how to store the result into a variable in say x so that I can get it as %x%
echo %x% can show me the random number generated.
Is there a way to generate a random alpha-num string without using setlocal enabledelayedexpansion.