home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / vrac / 4btmutil.zip / ONCEAWEK.BTM < prev    next >
Text File  |  1994-06-08  |  2KB  |  45 lines

  1. : ---------------------------------------------------------------------
  2. : onceawek.BTM
  3. @echo off
  4. :
  5. :       This batch file will start a specified command the first time it
  6. :       called each day after 6:00 in the morning
  7. :       example:
  8. :               onceawek DEFRAG C:
  9. :
  10. :      Note that, instead of REM statements, it uses the alternative
  11. :      practice of creating "do-nothing" labels by starting comment
  12. :      lines such as this one with a ":"
  13. :
  14. :
  15. :       First, we reset environment variable LASTDATE after saving any
  16. :       current value it may already have with the SETLOCAL command
  17. LoadBTM on
  18. setlocal
  19. set lastdate=0
  20. :       Is there already a file called onceawek.DAT in the
  21. :       root directory of the boot drive?
  22. iff exist %_boot:\onlyonce.dat then
  23. :       If so, set LASTDATE to the contents of the first line
  24.     find "lastweek" %_boot:\onlyonce.dat | set lastdate=%@substr[%@line[con,2],9]
  25.     if .%lastdate==. set lastdate=0
  26. endiff
  27. :       Is the date in the file greater than today's date?
  28. :       (the @DATE function turns a date into an integer number)
  29. iff %@date[%_date] gt %@eval[%lastdate+6] then
  30. :       If so, is it currently past 6:00? (an arbitrary time)
  31.   iff %time[%_time] gt %@time[10:00] then
  32. :       Yes! Invoke whatever command was passed as an argument to this
  33. :       batch file, then return
  34. :       Place today's date in integer format into file onceawek.DAT
  35.     (
  36.        find/v "lastweek" %_boot:\onlyonce.dat|find/v "lastday"^
  37.        echo lastweek %@date[%_date]^
  38.        echo lastday %@date[%_date]^
  39.     ) >! %_boot:\onlyonce.dat
  40.     attrib +h %_boot:\onlyonce.dat /q
  41.     call `%&`
  42.   endiff
  43. endiff
  44. :
  45.