AceInfinity
Emeritus, Contributor
Code:
@echo off
setlocal enableextensions enabledelayedexpansion
set len=15
set str=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz.@#$*()?/\{}[]
call :GetLength %str%
set /a n=0
:A
set /a rnd=%random% %% %i%+1
set out=!out!!str:~%rnd%,1!
set /a n+=1
if not %n%==%len% goto :A
echo !out!
pause && goto :EOF
:GetLength
set i=0
set arg=%1
:N
set T=!arg:~%i%,1!
if defined T (
set /a i+=1
goto :N
)
Here's a password/passkey generator I wrote just a few minutes ago. It works nicely, the only problem is providing support for special characters like , % ! etc...
Change len and str variables to determine what characters to be using, and the output length of the generated pass. The :GetLength function actually calculates the length of the str variable, because we need this to return a specific character at a specific index within that variable.
Following along it may look pretty convoluted, but it's actually, pretty simple lol. For anybody that can understand this, if you walk through it, it's much easier than it looks. :)