Skip to content

Instantly share code, notes, and snippets.

@jbulies
Created January 31, 2023 20:33
Show Gist options
  • Save jbulies/3f1347370dfc406ed0433d338e122d4f to your computer and use it in GitHub Desktop.
Save jbulies/3f1347370dfc406ed0433d338e122d4f to your computer and use it in GitHub Desktop.
Generate a random string (Batch Script)
@echo off
setlocal enabledelayedexpansion
set "string=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
set "result="
for /L %%i in (1,1,64) do call :add
echo %result%
goto :eof
:add
set /a x=%random% %% 62
set result=%result%!string:~%x%,1!
goto :eof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment