batch file help %random% questions

March 28, 2012 at 06:17:55
Specs: Windows XP
i need to know how to make a random question askedin a batch file. example:

i want it to ask at random when opened,
hows it going?
or
what day is it?


See More: batch file help %random% questions

Report •

#1
March 28, 2012 at 06:21:42
this is what i have


:q1
SET /P ANSWER=Hey, hows it going? (type answers to exact text) (BAD/GOOD)?
echo You chose: %ANSWER%
if /i {%ANSWER%}=={G} (goto :GOOD)
if /i {%ANSWER%}=={GOOD} (goto :GOOD)
if /i {%ANSWER%}=={B} (goto :BAD)
if /i {%ANSWER%}=={BAD} (goto :BAD)
goto :q1

:GOOD
color 07
echo ...
echo (; cool, i can feel emotions. I'm a computer.
echo ...
pause
goto :q2

:Bad
color 07
echo ...
echo That sucks. ... ... ...
echo ...
pause
goto :q3

:q5
color 07
SET /P ANSWER=What day is it? (SU/M/T/W/TH/F/S)?
echo You chose: %ANSWER%
if /i {%ANSWER%}=={SU} (goto :Sunday)
if /i {%ANSWER%}=={Sunday} (goto :Sunday)
if /i {%ANSWER%}=={M} (goto :Monday)
if /i {%ANSWER%}=={Monday} (goto :Monday)
if /i {%ANSWER%}=={T} (goto :Tuesday)
if /i {%ANSWER%}=={Tuesday} (goto :Tuesday)
if /i {%ANSWER%}=={W} (goto :Wednesday)
if /i {%ANSWER%}=={Wednesday} (goto :Wednesday)
if /i {%ANSWER%}=={TH} (goto :Thursday)
if /i {%ANSWER%}=={Thursday} (goto :Thursday)
if /i {%ANSWER%}=={F} (goto :Friday)
if /i {%ANSWER%}=={S} (goto :Saturday)
if /i {%ANSWER%}=={Saturday} (goto :Saturday)
if /i {%ANSWER%}=={Friday} (goto :Friday)
goto :q5

:Sunday
color 07
echo ...
echo I get to go to church today! I LOVE church!
echo ...
goto :q8

:Monday
color 07
echo ...
echo I hate mondays.
echo ...
pause
goto :q8

:Tuesday
color 07
echo ...
echo Fun Fact, You brain works at maximum capacity on tuesdays.
echo ...
pause
goto :q8


:Wednessday
color 07
echo ...
echo 2 more days until the weekend.
echo ...
pause
goto :q8


:Thursday
color 07
echo ...
echo Thursdays are so long... ... ... ... ...
echo ...
pause
goto :q8


:Friday
color 07
echo ...
echo It's Friday, I love fridays! OMG! *freek out* Friday!!!!
echo ...
pause
goto :q8


:Saturday
color 07
echo ...
echo It's the weekend! I think i'll go fishing.
echo ...
pause
goto :q8

ignore the goto q's ok...



Report •

#2
March 28, 2012 at 08:10:16
REM ON THE WAY TO BEING DEKLUDGED
REM Not Sure what all you wanted to accomplish, so i added a little bit of direction
rem Happy to Help you further, depending on what you need

@ECHO OFF
:q1
SET /P ANSWER=Hey, hows it going? (type answers to exact text) (BAD/GOOD/GOAWAY)?
echo You chose: %ANSWER%
if /i %ANSWER% EQU G goto GOOD
if /i %ANSWER% EQU GOOD goto GOOD
if /i %ANSWER% EQU B goto BAD
if /i %ANSWER% EQU BAD goto BAD
if /i %ANSWER% EQU GOAWAY goto EXIT1

goto :q1

:GOOD
color 07
echo ...
echo (^; cool, i can feel emotions. I'm a computer.
echo ...
pause
goto :q5

:BAD
color 07
echo ...
echo That sucks. ... ... ...
ECHO see you tommorrow
echo ...
pause
goto :q3

:q5
color 07
SET /P ANSWER2=What day is it? (SU/M/T/W/TH/F/S)?
echo You chose: %ANSWER2%
if /i %ANSWER2% equ SU goto Sunday
if /i %ANSWER2% equ Sunday goto Sunday
if /i %ANSWER2% equ M goto Monday
if /i %ANSWER2% equ Monday goto Monday
if /i %ANSWER2% equ T goto Tuesday
if /i %ANSWER2% equTuesday goto Tuesday
if /i %ANSWER2% equ W goto Wednesday
if /i %ANSWER% equ Wednesday goto Wednesday
if /i %ANSWER% equ TH goto Thursday
if /i %ANSWER% equ Thursday goto Thursday
if /i %ANSWER% equ F goto Friday
if /i %ANSWER% equ S goto Saturday
if /i %ANSWER% equ Saturday goto Saturday
if /i %ANSWER% equ Friday goto Friday
goto :q5
:Sunday
color 07
echo ...
echo I get to go to church today! I LOVE church!
echo ...
pause
goto :q8
:Monday
color 07
echo ...
echo I hate mondays.
echo ...
pause
goto :q8
:Tuesday
color 07
echo ...
echo Fun Fact, You brain works at maximum capacity on tuesdays.
echo ...
pause
goto :q8

:Wednesday
color 07
echo ...
echo 2 more days until the weekend.
echo ...
pause
goto :q8

:Thursday
color 07
echo ...
echo Thursdays are so long... ... ... ... ...
echo ...
pause
goto :q8

:Friday
color 07
echo ...
echo It's Friday, I love fridays! OMG! *freek out* Friday!!!!
echo ...
pause
goto :q8

:Saturday
color 07
echo ...
echo It's the weekend! I think i'll go fishing.
echo ...
pause
goto :q8

:q3
:q8
:EXIT1

mike


Report •

#3
April 4, 2012 at 11:21:43
I think he wanted the batch file to decide one of those phrases to say at the start at random. If I'm correct, "%random%" will only put out numbers. Don't take my word for it though, I'm new at all this.

Report •
Related Solutions


Ask Question