I was wondering how to make a batch file that runs a certain command/commands based on the date. I have a script that is based on the day of the week:
IF %DATE:~0,3%==Mon CALL (File/program/directory)
IF %DATE:~0,3%==Tue CALL (File/program/directory)
IF %DATE:~0,3%==Wed CALL (File/program/directory)
IF %DATE:~0,3%==Thu CALL (File/program/directory)
IF %DATE:~0,3%==Fri CALL (File/program/directory)
IF %DATE:~0,3%==Sat CALL (File/program/directory)
IF %DATE:~0,3%==Sun CALL (File/program/directory)
But I need one more specific, like开发者_开发技巧 it runs a program on someone's birthday. Thanks for your help!
If you do it the same way like your current solution, it should be simple.
But it depends on your date/time format.
if "%DATE:~9,5%"=="11/04" call birthdayOfPeter.bat
There is another method to do it.
this code will start your program on 11/02/2014
(edit when ever you want to start)
copy anything.bat
to startup
type this in anything.bat
:
@echo off
:finddate
if %date% GEQ 11/02/2014 goto start
goto finddate
:start
start "your program"
goto end
:end
精彩评论