I have made a code that is supposed to start a different program on when you input what day of the week it is, but it doesn't run them when I want them too, Please may someone help me?
The code is this:@echo off
cd RosaryMysteries
title Rosary
color 1e
:start
echo The Rosary
echo.
pausegoto choice
REM joyful
:joyful
start joyful.bat
exitREM sorrowful
:sorrowful
start sorrowful.bat
exitREM luminous
:luminous
start luminous.bat
exitREM glorious
:glorious
start glorious.bat
exitREM choice
:choice
cls
set /p day = What is the day of the week today? (No caps please)
if /i {%day%}=={monday} then goto :joyful
if /i {%day%}=={tuesday} then goto :sorrowful
if /i {%day%}=={wednesday} then goto :glorious
if /i {%day%}=={thursday} then goto :luminous
if /i {%day%}=={friday} then goto :sorrowful
if /i {%day%}=={saturday} then goto :joyful
if /i {%day%}=={sunday} then goto :glorious
Replace (the same for each IF statement)
if /i {%day%}=={monday} then goto :joyful
with
if /I "%day%"=="monday" goto :joyful
and avoid spaces around = in SET statements, i.e.
set /P day=What is the day of the week today? (No caps please)^>
By the way the /I switch of IF statement forces to ignore upper/lower case. More to launch the selected batch and exit just code, e.g.
joyful
not
start joyful.bat
exit
The above leads to a straightforward code as
if /I "%day%"=="monday" joyful
I can send you a little program to autodetect the day of the week without prompting the user. If interested contact me by a private message reporting your e-mail address.
| « [Solved] Text files read in direct... | vb script connect to linu... » |