after searching this site for "how to generate a password with CMD" I found some very useful examples. Then, I wanted to be able to print more then one password at a time (who would want to click all day on that) and I found some code that it can run the generator code for a defined number of time. What I want to do next, is to try and print all of the generated passwords in a one single .txt file. I know you have to use the "command > [drive:\path*.txt]" for that but, I don't know how :/. After I combined the generator and the loop code I got something like this, but it prints only one password in the file. When the other one is generated, the old one is replaced. Any help? :D
@echo off
set execute counter=0
:loop
(@Echo off
rem 16 stings pwd
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
set alfanum=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
set pwd=
FOR /L %%b IN (0, 1, 16) DO (
SET /A rnd_num=!RANDOM! * 62 / 32768 + 1
for /F %%c in ('echo %%alfanum:~!rnd_num!^,1%%') do set pwd=!pwd!%%c
)
echo pwd=%pwd% > D:\password.txt
) :: This here between the () is the on line password generator
set /a executecounter=%executecounter%+1
if "%executecounter%"=="30" goto done
goto loop
:done
echo Complete!
pause