Bat File - If date = this, then run that, else quit

I want to run a bat file every morning, have it look at the date, and compare it against a list of dates.  If today is on the list, I want to execute a command.  If today is not on the list, simply end.

So for example:
01/30/08
02/28/08
03/30/08

If today is one of these dates, run program.exe

can someone whip up a bat file that will do this?

Thanks,
Greg
BILLBACKUSAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

darron_chapmanCommented:
@echo off
For /f "tokens=1-7 delims=:/-, " %%i in ('echo exit^|cmd /q /k"prompt $D $T"') do (
      For /f "tokens=2-4 delims=/-,() skip=1" %%a in ('echo.^|date') do (
            set dow=%%i
            set %%a=%%j
            set %%b=%%k
            set %%c=%%l
            set hh=%%m
            set min=%%n
            set ss=%%o
      )
)

set today=%mm%/%dd%/%yy%

if "%today%"=="01/30/2008" GOTO ENDOFJAN
if "%today%"=="02/28/2008" GOTO ENDOFFEB
if "%today%"=="03/20/2008" GOTO ENDOFMAR
GOTO END

:ENDOFJAN
REM STUFF GOES HERE
GOTO END

:ENDOFFEB
REM STUFF GOES HERE
GOTO END

:ENDOFMAR
REM STUFF GOES HERE
GOTO END


:END
0
darron_chapmanCommented:
@echo off
For /f "tokens=1-7 delims=:/-, " %%i in ('echo exit^|cmd /q /k"prompt $D $T"') do (
      For /f "tokens=2-4 delims=/-,() skip=1" %%a in ('echo.^|date') do (
            set dow=%%i
            set %%a=%%j
            set %%b=%%k
            set %%c=%%l
            set hh=%%m
            set min=%%n
            set ss=%%o
      )
)

set today=%mm%/%dd%/%yy%

if "%today%"=="01/30/2008" GOTO RUNPROG
if "%today%"=="02/28/2008" GOTO RUNPROG
if "%today%"=="02/28/2008" GOTO RUNPROG
GOTO END

:RUNPROG
program.exe

:END
0
darron_chapmanCommented:
Sorry, last 02/28/2008 should be 03/30/2008
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
UbuntopCommented:
If you are keeping the Dates in a separate file, you can use the following two lines. Note: the date format should be MM/DD/YYYY .

For /f "tokens=1,2" %%A in ('date /T') DO SET SysDate=%%B
For /f %%G in (dates.txt) Do If %SysDate%==%%G ECHO Yes


Your date file should look like this (dates.txt)
01/30/2008
02/28/2008
03/30/2008
01/28/2008

In the second line above, just delete "ECHO YES" and put in your command or batch to launch.
0
BILLBACKUSAuthor Commented:
perfect thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.