FULLSCREEN CONTENTS Project Home Page
.EXAMPLE.....: 61 DO-ONCE: Run apps when booting for the first time of the day
.ALIAS.......: 61
.CATEGORY....: examples 
.CODE........:

COMMENT
  Put this code in AUTOEXEC.BAT.  Note that this batch code requires DOS
  3.3+, since it uses CALL.

if not exist C:\LASTRUN.BAT goto RunNow

:: call LASTRUN.BAT, which will set an environment variable, %LASTRUN%,
:: that will contain the date when this batch file was last run.
:: ------------------------------------------------------------------
call C:\LASTRUN.BAT

:: compare the date in %LASTRUN% to today's date
:: ------------------------------------------------------------------
Fdate /Fcomp /At /B%LastRun% /Vcomp


:: Today's date may be less than %LASTRUN% if you reset the system clock
IF (%COMP%)==(LT) goto NoRun

:: If %LASTRUN% was the same as today's date,

:: then this batch file has already been run once today
IF (%COMP%)==(EQ) goto NoRun


:: Daily processing hasn't been run today. Run it.

:: Here, you should put the batch-file body --

:: the code to run the applications that you want to run once per day

::


:: ------------------------------------------------------------------

:: Save today's date in a new version of LastRun.BAT. Note that

:: this code will be executed only if daily processing runs to

:: completion without hanging the machine or aborting the batch file.

:: ------------------------------------------------------------------
Fdate /Ff /Omm-dd-ccyy /At /P"@set LastRun=">LastRun.BAT


:NoRun
set LastRun=
set COMP=