home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1995 November
/
PCWK1195.iso
/
inne
/
podstawy
/
dos
/
4dos
/
4uzytki
/
4btmutil.exe
/
ONCEADAY.BTM
< prev
next >
Wrap
Text File
|
1994-06-08
|
2KB
|
42 lines
: ---------------------------------------------------------------------
: ONCEADAY.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:
: ONCEADAY 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 ONCEADAY.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 "lastday" %_boot:\onlyonce.dat | set lastdate=%@substr[%@line[con,2],8]
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 %lastdate 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
call `%&`
: After executing the command, place today's date in integer
: format into file ONCEADAY.DAT
(find/v "lastday" %_boot:\onlyonce.dat^echo lastday %@date[%_date]) >! %_boot:\onlyonce.dat
attrib +h %_boot:\onlyonce.dat /q
endiff
endiff
: