home *** CD-ROM | disk | FTP | other *** search
- echo off
- echo.
- echo ┌───────────────────────────────────────────────────┐
- echo │ Run a program only once a day at boot time │
- echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, 9-Sep-91 │
- echo └───────────────────────────────────────────────────┘
-
- if "%1"=="" goto _help
-
- rem What date was this bacth last run
- if exist date1$$$ goto _date_now
- echo Not yet run today > date1$$$
-
- :_date_now
- rem What is the current date
- echo.|date > date2$$$
-
- rem Compare the last and the current date
- fc date2$$$ date1$$$ > tmp$$$
- type tmp$$$ | find /v "fc: no differences encountered" > diffe$$$
- del tmp$$$
- if exist doit$$$ del doit$$$
- copy diffe$$$ doit$$$ > nul
- del diffe$$$
-
- rem Move the current date information to the last run date variable
- copy date2$$$ date1$$$ > nul
- del date2$$$
-
- rem Don't run if the dates match
- if not exist doit$$$ goto _done
- del doit$$$
-
- rem Make the call
- call %1 %2 %3 %4 %5 %6 %7 %8 %9
- goto _out
-
- :_help
- echo.
- echo If you want to run a program only once a day when you reboot
- echo your computer, put
- echo.
- echo CALL DAILY YourApplicationName [Param1] [Param2] [...]
- echo.
- echo in your autoexec.bat file.
- goto _out
-
- :_done
- echo %0 has already been run today
-
- :_out
- echo on
-