This should fix your existing batch file so it works.
@echo off
set "prefix=LONDON"
:Start2
cls
goto Start
:Start
title Welcome to my Password Generator
echo I will make you a new password.
echo Please write the password down somewhere in case you forget it.
echo ---------------------------------------------------------------
echo 1) 1 Random Password
echo 2) 5 Random Passwords
echo 3) 10 Random Passwords
echo Input your choice
set input=
set /p input= Choice:
if "%input%."=="." goto :Start
if %input%==1 goto A
if %input%==2 goto B
if %input%==3 goto C
goto :Start
:A
cls
echo Your password is %prefix%%random%
:reprompt1
echo Now choose what you want to do.
echo 1) Go back to the beginning
echo 2) Exit
set input=
set /p input= Choice:
if "%input%."=="." goto :reprompt1
if %input%==1 goto Start2
if %input%==2 goto Exit
goto :reprompt1
:Exit
goto :EOF
rem exit
:B
cls
echo Your 5 passwords are %prefix%%random%, %prefix%%random%, %prefix%%random%, %prefix%%random%, %prefix%%random%.
:reprompt5
echo Now choose what you want to do.
echo 1) Go back to the beginning
echo 2) Exit
set input=
set /p input= Choice:
if "%input%."=="." goto :reprompt5
if %input%==1 goto Start2
if %input%==2 goto Exit
goto :reprompt5
:C
cls
echo Your 10 Passwords are %prefix%%random%, %prefix%%random%, %prefix%%random%, %prefix%%random%, %prefix%%random%, %prefix%%random%, %prefix%%random%, %prefix%%random%, %prefix%%random%, %prefix%%random%
:reprompt10
echo Now choose what you want to do.
echo 1) Go back to the beginning
echo 2) Exit
set input=
set /p input= Choice:
if "%input%."=="." goto :reprompt10
if %input%==1 goto Start2
if %input%==2 goto Exit
goto :reprompt10
If you need something different, just let me know.
Edit:
I just noticed the comment indicating you need the results to be in the range of LONDON01
to LONDON100
, so I modified the batch file to do that:
@echo off
set "prefix=LONDON"
:Start2
cls
goto Start
:Start
title Welcome to my Password Generator
echo I will make you a new password.
echo Please write the password down somewhere in case you forget it.
echo ---------------------------------------------------------------
echo 1) 1 Random Password
echo 2) 5 Random Passwords
echo 3) 10 Random Passwords
echo Input your choice
set input=
set /p input= Choice:
if "%input%."=="." goto :Start
if %input%==1 goto A
if %input%==2 goto B
if %input%==3 goto C
goto :Start
:A
cls
call :getpws 1
call :showpws 1
:reprompt1
echo Now choose what you want to do.
echo 1) Go back to the beginning
echo 2) Exit
set input=
set /p input= Choice:
if "%input%."=="." goto :reprompt1
if %input%==1 goto Start2
if %input%==2 goto Exit
goto :reprompt1
:Exit
set "pw1="
set "pw2="
set "pw3="
set "pw4="
set "pw5="
set "pw6="
set "pw7="
set "pw8="
set "pw9="
set "pw10="
set "pwcount="
set "pwindex="
set "pwmessage="
set "pwresult="
goto :EOF
rem exit
:B
cls
call :getpws 5
call :showpws 5
:reprompt5
echo Now choose what you want to do.
echo 1) Go back to the beginning
echo 2) Exit
set input=
set /p input= Choice:
if "%input%."=="." goto :reprompt5
if %input%==1 goto Start2
if %input%==2 goto Exit
goto :reprompt5
:C
cls
call :getpws 10
call :showpws 10
:reprompt10
echo Now choose what you want to do.
echo 1) Go back to the beginning
echo 2) Exit
set input=
set /p input= Choice:
if "%input%."=="." goto :reprompt10
if %input%==1 goto Start2
if %input%==2 goto Exit
goto :reprompt10
:getpws
set pwcount=%~1
rem this step (clear) not totally necessary...
call :clearallpws
for /L %%f in (1,1,%pwcount%) do call :get1pw %%f
goto :EOF
:clearallpws
for /L %%f in (1,1,10) do call :clearpw %%f
goto :EOF
:clearpw
rem clear password numbered by %1
set pwindex=%~1
for /F "usebackq delims=" %%g in (`echo set "pw%pwindex%="`) do %%g
goto :EOF
:get1pw
set pwindex=%~1
rem get a random number, add a leading 0 to make sure it is at least 2 digits long
set pwresult=0%random%
rem keep the last two digits
set "pwresult=%pwresult:~-2,2%"
rem this will now be something from 00 to 99
rem now add 1
set /a pwresult+=1
rem this will now be a number from 1 to 100. Add leading "0" for numbers below 10
if %pwresult% LEQ 9 set "pwresult=0%pwresult%"
rem this will now be a number from 01 to 100. Insert the prefix
set "pwresult=%prefix%%pwresult%
rem now assign it to pw(n) variable. and return
for /F "usebackq delims=" %%g in (`echo set "pw%pwindex%=%pwresult%"`) do %%g
goto :EOF
:showpws
set pwcount=%~1
set "pwmessage=Your %pwcount% passwords are: %pw1%"
if %pwcount% EQU 1 set "pwmessage=Your password is: %pw1%"
for /L %%g in (2,1,%pwcount%) do call :append1pw %%g
echo %pwmessage%
goto :EOF
:append1pw
set pwindex=%~1
for /F "usebackq delims=" %%h in (`echo set "pwmessage=%pwmessage%, %%pw%pwindex%%%"`) do %%h
goto :EOF
My current opinion would be to get with the times and move it to Powershell... Would that work too? Or is Batch a requirement? – Austin T French – 2013-04-08T19:16:34.703
Batch is a requirement due to restrictions on the office PCs. We need this for our desktop agents. – Jonathan Paul Gregory – 2013-04-08T19:24:34.573
Check out http://superuser.com/questions/349474/how-do-you-make-a-letter-password-generator-in-batch
– Ofiris – 2013-04-08T19:34:03.617How do I make it use "LONDON" Then a pre-defined number for eg. LONDON05 LONDON04 LONDON03 – Jonathan Paul Gregory – 2013-04-08T19:39:12.490
It needs to generate a password from LONDON01 to LONDON100 – Jonathan Paul Gregory – 2013-04-08T19:39:28.157
IF anyone can help Please Jump in! – Jonathan Paul Gregory – 2013-04-08T19:50:11.003
3Why do you need passwords so easily guessable? – That Brazilian Guy – 2013-04-08T20:53:49.213
Welcome to Superuser.com (SU). If any of the answers have resolved your question, you could indicate you have accepted that answer by clicking the checkmark on the left side of the answer (when clicked, the checkmark will change from white to green). If some answers are "almost" working for you, you could leave a comment asking for more help. – Kevin Fegan – 2013-04-13T00:41:39.243