Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pass Generator Batch script
#1
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Batch tutorial goes here? fanta 3 1,520 05-22-2012, 09:25 PM
Last Post: AceInfinity
  [Batch] Trick - View Environment Variables AceInfinity 0 976 05-05-2012, 07:01 PM
Last Post: AceInfinity
  [Batch] Quick Drive Information Script (Created by AceInfinity) AceInfinity 17 7,248 02-09-2012, 08:10 AM
Last Post: AceInfinity
  [Batch Game] Rock, Paper, Scissor by Hack0pz hackopz 3 2,571 01-22-2012, 05:17 PM
Last Post: AceInfinity
  [Batch Script] File Binary Data Compare - (Drag & Drop / Command Line Args) AceInfinity 5 3,156 01-14-2012, 05:59 AM
Last Post: ISO

Forum Jump:


Users browsing this thread: 1 Guest(s)