home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1995 November
/
PCWK1195.iso
/
inne
/
podstawy
/
dos
/
4dos
/
4uzytki
/
4btmutil.exe
/
ONCEAWEK.BTM
< prev
next >
Wrap
Text File
|
1994-06-08
|
2KB
|
45 lines
: ---------------------------------------------------------------------
: onceawek.BTM
@echo off
:
: This batch file will start a specified command the first time it
: called each day after 6:00 in the morning
: example:
: onceawek DEFRAG C:
:
: Note that, instead of REM statements, it uses the alternative
: practice of creating "do-nothing" labels by starting comment
: lines such as this one with a ":"
:
:
: First, we reset environment variable LASTDATE after saving any
: current value it may already have with the SETLOCAL command
LoadBTM on
setlocal
set lastdate=0
: Is there already a file called onceawek.DAT in the
: root directory of the boot drive?
iff exist %_boot:\onlyonce.dat then
: If so, set LASTDATE to the contents of the first line
find "lastweek" %_boot:\onlyonce.dat | set lastdate=%@substr[%@line[con,2],9]
if .%lastdate==. set lastdate=0
endiff
: Is the date in the file greater than today's date?
: (the @DATE function turns a date into an integer number)
iff %@date[%_date] gt %@eval[%lastdate+6] then
: If so, is it currently past 6:00? (an arbitrary time)
iff %time[%_time] gt %@time[10:00] then
: Yes! Invoke whatever command was passed as an argument to this
: batch file, then return
: Place today's date in integer format into file onceawek.DAT
(
find/v "lastweek" %_boot:\onlyonce.dat|find/v "lastday"^
echo lastweek %@date[%_date]^
echo lastday %@date[%_date]^
) >! %_boot:\onlyonce.dat
attrib +h %_boot:\onlyonce.dat /q
call `%&`
endiff
endiff
: