Is it possible to write multiple Variables in one .txt document in batch? I would like to make a random password generator where you first have to say how many characters the password must be long and then the password gets generated and put in a .txt file
My idea was that first (after you said how long the password should be) a random number is generated (for the start 1, 2 or 3 (1 = a, 2 = b, 3 = c)). Then it looks which number was chosen and then the corresponding letter is searched and written into the txt document until it has as many characters as you said at the beginning.
That would look like that:
@echo off
:main
cls
set /p anz=How many characters?:
goto rand
:rand
set /a letter=%random% %%3
goto test
:test
if %letter%==1 goto 1
if %letter%==2 goto 2
if %letter%==3 goto 3
:1
if %anz%==0 goto finish
set /p print=a
set /a anz-=1
goto printin
:2
if %anz%==0 goto finish
set /p print=b
set /a anz-=1
goto printin
:3
if %anz%==0 goto finish
set /p print=c
set /a anz-=1
goto printin
:printin
echo %print% > Your_Password.txt <--- Here does the letter get written in the .txt file
goto rand
:finish
echo finish
goto main
But it only writes the last letter in the .txt file
For the beginning i have only made it with a, b, c in future i want to add the entire Alphabet
I am quite new in batch and collecting first my first experiences