Solved Problem WITH variables AGAIN

September 23, 2012 at 12:40:06
Specs: Windows 7
Alright so i got my program to generate 12 random charactes. but i need it to generate 12 new random characters for every single line. currently, it generates a set of 12 characters and uses that same set for all 11 lines i have... Here is the code, please edit if you know how to fix it:

:TERMINALP2
@ECHO OFF
CLS
ECHO ROBCO INDUSTRIES (TM) TERMLINK PROTOCOL
ECHO ENTER PASSWORD NOW
ECHO.
ECHO.
ECHO.
ECHO 4 ATTEMP(S) LEFT: Û Û Û Û
ECHO.
REM game starts here
REM ===============================================
REM variable d is 12 characters ALWAYS
REM variable d contains 8 words ALWAYS
REM variable d contains 1 correct word ALWAYS
REM variable q contains < or = 13 characters ALWAYS
REM variable q starts with "<" ALWAYS
REM variable d also contains up to 15 total words, one of which is the correct password
REM variable d also contains "duds" which are up to 5 characters inbetween grouping symbols of the same type
REM selecting a dud gives you 1 more attempt
REM selecting the wrong word removes 1 attempt
REM ===============================================
set /a rand=%random% %% 28 +1
IF /I %rand%==1 set va=^!
IF /I %rand%==2 set va=^@
IF /I %rand%==3 set va=^#
IF /I %rand%==4 set va=^$
IF /I %rand%==5 set va=^_
IF /I %rand%==6 set va=^&
IF /I %rand%==7 set va=^*
IF /I %rand%==8 set va=^(
IF /I %rand%==9 set va=^)
IF /I %rand%==10 set va=^+
IF /I %rand%==11 set va=^-
IF /I %rand%==12 set va=^=
IF /I %rand%==13 set va=^[
IF /I %rand%==14 set va=^]
IF /I %rand%==15 set va=^\
IF /I %rand%==16 set va=^{
IF /I %rand%==17 set va=^}
IF /I %rand%==18 set va=^|
IF /I %rand%==19 set va=^;
IF /I %rand%==20 set va=^'
IF /I %rand%==21 set va=^:
IF /I %rand%==22 set va=^"
IF /I %rand%==23 set va=^<
IF /I %rand%==24 set va=^>
IF /I %rand%==25 set va=^?
IF /I %rand%==26 set va=^,
IF /I %rand%==27 set va=^.
IF /I %rand%==28 set va=^/
REM ==================================
set /a rand2=%random% %% 28 +1
IF /I %rand2%==1 set va2=^!
IF /I %rand2%==2 set va2=^@
IF /I %rand2%==3 set va2=^#
IF /I %rand2%==4 set va2=^$
IF /I %rand2%==5 set va2=^<
IF /I %rand2%==6 set va2=^&
IF /I %rand2%==7 set va2=^*
IF /I %rand2%==8 set va2=^(
IF /I %rand2%==9 set va2=^)
IF /I %rand2%==10 set va2=^+
IF /I %rand2%==11 set va2=^-
IF /I %rand2%==12 set va2=^=
IF /I %rand2%==13 set va2=^[
IF /I %rand2%==14 set va2=^]
IF /I %rand2%==15 set va2=^\
IF /I %rand2%==16 set va2=^{
IF /I %rand2%==17 set va2=^}
IF /I %rand2%==18 set va2=^|
IF /I %rand2%==19 set va2=^;
IF /I %rand2%==20 set va2=^'
IF /I %rand2%==21 set va2=^:
IF /I %rand2%==22 set va2=^"
IF /I %rand2%==23 set va2=^<
IF /I %rand2%==24 set va2=^>
IF /I %rand2%==25 set va2=^?
IF /I %rand2%==26 set va2=^,
IF /I %rand2%==27 set va2=^.
IF /I %rand2%==28 set va2=^/
REM ==================================
set /a rand3=%random% %% 28 +1
IF /I %rand3%==1 set va3=^!
IF /I %rand3%==2 set va3=^@
IF /I %rand3%==3 set va3=^#
IF /I %rand3%==4 set va3=^$
IF /I %rand3%==5 set va3=^<
IF /I %rand3%==6 set va3=^&
IF /I %rand3%==7 set va3=^*
IF /I %rand3%==8 set va3=^(
IF /I %rand3%==9 set va3=^)
IF /I %rand3%==10 set va3=^+
IF /I %rand3%==11 set va3=^-
IF /I %rand3%==12 set va3=^=
IF /I %rand3%==13 set va3=^[
IF /I %rand3%==14 set va3=^]
IF /I %rand3%==15 set va3=^\
IF /I %rand3%==16 set va3=^{
IF /I %rand3%==17 set va3=^}
IF /I %rand3%==18 set va3=^|
IF /I %rand3%==19 set va3=^;
IF /I %rand3%==20 set va3=^'
IF /I %rand3%==21 set va3=^:
IF /I %rand3%==22 set va3=^"
IF /I %rand3%==23 set va3=^<
IF /I %rand3%==24 set va3=^>
IF /I %rand3%==25 set va3=^?
IF /I %rand3%==26 set va3=^,
IF /I %rand3%==27 set va3=^.
IF /I %rand3%==28 set va3=^/
REM ==================================
set /a rand4=%random% %% 28 +1
IF /I %rand4%==1 set va4=^!
IF /I %rand4%==2 set va4=^@
IF /I %rand4%==3 set va4=^#
IF /I %rand4%==4 set va4=^$
IF /I %rand4%==5 set va4=^<
IF /I %rand4%==6 set va4=^&
IF /I %rand4%==7 set va4=^*
IF /I %rand4%==8 set va4=^(
IF /I %rand4%==9 set va4=^)
IF /I %rand4%==10 set va4=^+
IF /I %rand4%==11 set va4=^-
IF /I %rand4%==12 set va4=^=
IF /I %rand4%==13 set va4=^[
IF /I %rand4%==14 set va4=^]
IF /I %rand4%==15 set va4=^\
IF /I %rand4%==16 set va4=^{
IF /I %rand4%==17 set va4=^}
IF /I %rand4%==18 set va4=^|
IF /I %rand4%==19 set va4=^;
IF /I %rand4%==20 set va4=^'
IF /I %rand4%==21 set va4=^:
IF /I %rand4%==22 set va4=^"
IF /I %rand4%==23 set va4=^<
IF /I %rand4%==24 set va4=^>
IF /I %rand4%==25 set va4=^?
IF /I %rand4%==26 set va4=^,
IF /I %rand4%==27 set va4=^.
IF /I %rand4%==28 set va4=^/
REM ==================================
set /a rand5=%random% %% 28 +1
IF /I %rand5%==1 set va5=^!
IF /I %rand5%==2 set va5=^@
IF /I %rand5%==3 set va5=^#
IF /I %rand5%==4 set va5=^$
IF /I %rand5%==5 set va5=^<
IF /I %rand5%==6 set va5=^&
IF /I %rand5%==7 set va5=^*
IF /I %rand5%==8 set va5=^(
IF /I %rand5%==9 set va5=^)
IF /I %rand5%==10 set va5=^+
IF /I %rand5%==11 set va5=^-
IF /I %rand5%==12 set va5=^=
IF /I %rand5%==13 set va5=^[
IF /I %rand5%==14 set va5=^]
IF /I %rand5%==15 set va5=^\
IF /I %rand5%==16 set va5=^{
IF /I %rand5%==17 set va5=^}
IF /I %rand5%==18 set va5=^|
IF /I %rand5%==19 set va5=^;
IF /I %rand5%==20 set va5=^'
IF /I %rand5%==21 set va5=^:
IF /I %rand5%==22 set va5=^"
IF /I %rand5%==23 set va5=^<
IF /I %rand5%==24 set va5=^>
IF /I %rand5%==25 set va5=^?
IF /I %rand5%==26 set va5=^,
IF /I %rand5%==27 set va5=^.
IF /I %rand5%==28 set va5=^/
REM ==================================
set /a rand6=%random% %% 28 +1
IF /I %rand6%==1 set va6=^!
IF /I %rand6%==2 set va6=^@
IF /I %rand6%==3 set va6=^#
IF /I %rand6%==4 set va6=^$
IF /I %rand6%==5 set va6=^<
IF /I %rand6%==6 set va6=^&
IF /I %rand6%==7 set va6=^*
IF /I %rand6%==8 set va6=^(
IF /I %rand6%==9 set va6=^)
IF /I %rand6%==10 set va6=^+
IF /I %rand6%==11 set va6=^-
IF /I %rand6%==12 set va6=^=
IF /I %rand6%==13 set va6=^[
IF /I %rand6%==14 set va6=^]
IF /I %rand6%==15 set va6=^\
IF /I %rand6%==16 set va6=^{
IF /I %rand6%==17 set va6=^}
IF /I %rand6%==18 set va6=^|
IF /I %rand6%==19 set va6=^;
IF /I %rand6%==20 set va6=^'
IF /I %rand6%==21 set va6=^:
IF /I %rand6%==22 set va6=^"
IF /I %rand6%==23 set va6=^<
IF /I %rand6%==24 set va6=^>
IF /I %rand6%==25 set va6=^?
IF /I %rand6%==26 set va6=^,
IF /I %rand6%==27 set va6=^.
IF /I %rand6%==28 set va6=^/
REM ==================================
set /a rand7=%random% %% 28 +1
IF /I %rand7%==1 set va7=^!
IF /I %rand7%==2 set va7=^@
IF /I %rand7%==3 set va7=^#
IF /I %rand7%==4 set va7=^$
IF /I %rand7%==5 set va7=^<
IF /I %rand7%==6 set va7=^&
IF /I %rand7%==7 set va7=^*
IF /I %rand7%==8 set va7=^(
IF /I %rand7%==9 set va7=^)
IF /I %rand7%==10 set va7=^+
IF /I %rand7%==11 set va7=^-
IF /I %rand7%==12 set va7=^=
IF /I %rand7%==13 set va7=^[
IF /I %rand7%==14 set va7=^]
IF /I %rand7%==15 set va7=^\
IF /I %rand7%==16 set va7=^{
IF /I %rand7%==17 set va7=^}
IF /I %rand7%==18 set va7=^|
IF /I %rand7%==19 set va7=^;
IF /I %rand7%==20 set va7=^'
IF /I %rand7%==21 set va7=^:
IF /I %rand7%==22 set va7=^"
IF /I %rand7%==23 set va7=^<
IF /I %rand7%==24 set va7=^>
IF /I %rand7%==25 set va7=^?
IF /I %rand7%==26 set va7=^,
IF /I %rand7%==27 set va7=^.
IF /I %rand7%==28 set va7=^/
REM ==================================
set /a rand8=%random% %% 28 +1
IF /I %rand8%==1 set va8=^!
IF /I %rand8%==2 set va8=^@
IF /I %rand8%==3 set va8=^#
IF /I %rand8%==4 set va8=^$
IF /I %rand8%==5 set va8=^_
IF /I %rand8%==6 set va8=^&
IF /I %rand8%==7 set va8=^*
IF /I %rand8%==8 set va8=^(
IF /I %rand8%==9 set va8=^)
IF /I %rand8%==10 set va8=^+
IF /I %rand8%==11 set va8=^-
IF /I %rand8%==12 set va8=^=
IF /I %rand8%==13 set va8=^[
IF /I %rand8%==14 set va8=^]
IF /I %rand8%==15 set va8=^\
IF /I %rand8%==16 set va8=^{
IF /I %rand8%==17 set va8=^}
IF /I %rand8%==18 set va8=^|
IF /I %rand8%==19 set va8=^;
IF /I %rand8%==20 set va8=^'
IF /I %rand8%==21 set va8=^:
IF /I %rand8%==22 set va8=^"
IF /I %rand8%==23 set va8=^<
IF /I %rand8%==24 set va8=^>
IF /I %rand8%==25 set va8=^?
IF /I %rand8%==26 set va8=^,
IF /I %rand8%==27 set va8=^.
IF /I %rand8%==28 set va8=^/
REM ==================================
set /a rand9=%random% %% 28 +1
IF /I %rand9%==1 set va9=^!
IF /I %rand9%==2 set va9=^@
IF /I %rand9%==3 set va9=^#
IF /I %rand9%==4 set va9=^$
IF /I %rand9%==5 set va9=^_
IF /I %rand9%==6 set va9=^&
IF /I %rand9%==7 set va9=^*
IF /I %rand9%==8 set va9=^(
IF /I %rand9%==9 set va9=^)
IF /I %rand9%==10 set va9=^+
IF /I %rand9%==11 set va9=^-
IF /I %rand9%==12 set va9=^=
IF /I %rand9%==13 set va9=^[
IF /I %rand9%==14 set va9=^]
IF /I %rand9%==15 set va9=^\
IF /I %rand9%==16 set va9=^{
IF /I %rand9%==17 set va9=^}
IF /I %rand9%==18 set va9=^|
IF /I %rand9%==19 set va9=^;
IF /I %rand9%==20 set va9=^'
IF /I %rand9%==21 set va9=^:
IF /I %rand9%==22 set va9=^"
IF /I %rand9%==23 set va9=^<
IF /I %rand9%==24 set va9=^>
IF /I %rand9%==25 set va9=^?
IF /I %rand9%==26 set va9=^,
IF /I %rand9%==27 set va9=^.
IF /I %rand9%==28 set va9=^/
REM =================================
set /a rand10=%random% %% 28 +1
IF /I %rand10%==1 set va10=^!
IF /I %rand10%==2 set va10=^@
IF /I %rand10%==3 set va10=^#
IF /I %rand10%==4 set va10=^$
IF /I %rand10%==5 set va10=^_
IF /I %rand10%==6 set va10=^&
IF /I %rand10%==7 set va10=^*
IF /I %rand10%==8 set va10=^(
IF /I %rand10%==9 set va10=^)
IF /I %rand10%==10 set va10=^+
IF /I %rand10%==11 set va10=^-
IF /I %rand10%==12 set va10=^=
IF /I %rand10%==13 set va10=^[
IF /I %rand10%==14 set va10=^]
IF /I %rand10%==15 set va10=^\
IF /I %rand10%==16 set va10=^{
IF /I %rand10%==17 set va10=^}
IF /I %rand10%==18 set va10=^|
IF /I %rand10%==19 set va10=^;
IF /I %rand10%==20 set va10=^'
IF /I %rand10%==21 set va10=^:
IF /I %rand10%==22 set va10=^"
IF /I %rand10%==23 set va10=^<
IF /I %rand10%==24 set va10=^>
IF /I %rand10%==25 set va10=^?
IF /I %rand10%==26 set va10=^,
IF /I %rand10%==27 set va10=^.
IF /I %rand10%==28 set va10=^/
REM =================================
set /a rand11=%random% %% 28 +1
IF /I %rand11%==1 set va11=^!
IF /I %rand11%==2 set va11=^@
IF /I %rand11%==3 set va11=^#
IF /I %rand11%==4 set va11=^$
IF /I %rand11%==5 set va11=^_
IF /I %rand11%==6 set va11=^&
IF /I %rand11%==7 set va11=^*
IF /I %rand11%==8 set va11=^(
IF /I %rand11%==9 set va11=^)
IF /I %rand11%==10 set va11=^+
IF /I %rand11%==11 set va11=^-
IF /I %rand11%==12 set va11=^=
IF /I %rand11%==13 set va11=^[
IF /I %rand11%==14 set va11=^]
IF /I %rand11%==15 set va11=^\
IF /I %rand11%==16 set va11=^{
IF /I %rand11%==17 set va11=^}
IF /I %rand11%==18 set va11=^|
IF /I %rand11%==19 set va11=^;
IF /I %rand11%==20 set va11=^'
IF /I %rand11%==21 set va11=^:
IF /I %rand11%==22 set va11=^"
IF /I %rand11%==23 set va11=^<
IF /I %rand11%==24 set va11=^>
IF /I %rand11%==25 set va11=^?
IF /I %rand11%==26 set va11=^,
IF /I %rand11%==27 set va11=^.
IF /I %rand11%==28 set va11=^/
REM ================================
set /a rand12=%random% %% 28 +1
IF /I %rand12%==1 set va12=^!
IF /I %rand12%==2 set va12=^@
IF /I %rand12%==3 set va12=^#
IF /I %rand12%==4 set va12=^$
IF /I %rand12%==5 set va12=^_
IF /I %rand12%==6 set va12=^&
IF /I %rand12%==7 set va12=^*
IF /I %rand12%==8 set va12=^(
IF /I %rand12%==9 set va12=^)
IF /I %rand12%==10 set va12=^+
IF /I %rand12%==11 set va12=^-
IF /I %rand12%==12 set va12=^=
IF /I %rand12%==13 set va12=^[
IF /I %rand12%==14 set va12=^]
IF /I %rand12%==15 set va12=^\
IF /I %rand12%==16 set va12=^{
IF /I %rand12%==17 set va12=^}
IF /I %rand12%==18 set va12=^|
IF /I %rand12%==19 set va12=^;
IF /I %rand12%==20 set va12=^'
IF /I %rand12%==21 set va12=^:
IF /I %rand12%==22 set va12=^"
IF /I %rand12%==23 set va12=^<
IF /I %rand12%==24 set va12=^>
IF /I %rand12%==25 set va12=^?
IF /I %rand12%==26 set va12=^,
IF /I %rand12%==27 set va12=^.
IF /I %rand12%==28 set va12=^/
REM set /p %Q%=%TY%
REM set /p %TY%=^>
ECHO.
ECHO.
ECHO OxF92C ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% 0xF9F8 ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% %Q%
ECHO.
ECHO OxF938 ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% 0xFA04 ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% %Q%
ECHO.
ECHO OxF944 ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% 0xFA10 ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% %Q%
ECHO.
ECHO OxF950 ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% 0xFA1C ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% %Q%
ECHO.
ECHO 0xF96C ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% 0xFA28 ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% %Q%
ECHO.
ECHO 0xF978 ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% 0xFA34 ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% %Q%
ECHO.
ECHO 0xF984 ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% 0xFA40 ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% %Q%
ECHO.
ECHO 0xF980 ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% 0xFA4C ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% %Q%
ECHO.
ECHO 0xF99C ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% 0xFA58 ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% %Q%
ECHO.
ECHO 0xF908 ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% 0xFA64 ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% %Q%
ECHO.
ECHO 0xF9A4 ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% 0xFA70 ^%va% ^%va2% ^%va3% ^%va4% ^%va5% ^%va6% ^%va7% ^%va8% ^%va9% ^%va10% ^%va11% ^%va12% %Q%
ECHO.
ECHO.
ECHO.
set /p M=^>


See More: Problem WITH variables AGAIN

Report •


#1
September 26, 2012 at 15:03:13
✔ Best Answer
I don't know if some other member has solved the problem for you in a different post, here's my two-cents worth.

In the script you posted here the random characters are generate only once then echoed 12 times. In order to generate random chars for each line you must loop back to reset the VAn variables. I other words, generate the random chars for line 1, do whatever you want with the result, perhaps save the result in another variable, then loop back to generate the chars for line 2.

I leave the coding to you...


Please come back & tell us if your problem is resolved.


Report •

#2
September 26, 2012 at 18:16:47
omg thankyou so much i got this now!!!

Report •
Related Solutions


Ask Question