Bootinfo documentation

download setbootinfo.cmd

download getbootinfo.cmd
Include a line
call setbootinfo.cmd
somewhere in your startup command sequence, where it would get executed once per bootup. It will modify the file c:\bootinfo\bootinfo.txt (and also uses a couple other files in that directory) to contain information about the timestamp of the current boot cycle, and also the number of boot cycles experienced during the same day. So if the bootcount (first value) is 1, you know this is the first boot cycle of the day. Typically, you wouldn't care about values other than 1 or not 1, but the count is kept just in case.

Batch files that care about doing things only on the first boot cycle of a day, or about doing things on particularly days of the week or month or whatever, can then use getbootinfo.cmd to obtain the parameters. getbootinfo can be used from the command line or within batch files. The parameter "noshow" can be given to suppress the display of the variables as they are set. The parameters "date" and "detail" cause additional environment variables to be set.

parameter effect
Set environment variables bootcount and bootdow (day of week).
date Set environment variables bootcount, bootdow, bootdate, and boottime.
detail Set environment variables bootcount, bootdow, bootdate, boottime, bootyear, bootmonth, bootday, boothour bootminute, bootsecond, and bootfrac.
noshow Suppress display of enviroment variables

Examples of use

script to clear the mozilla download history

rem replace <path to profile> with your path to your profile, of course
@call getbootinfo noshow
@if %bootday%. = Mon. if %bootcount%. == 1. @(
@rem # delete download history from profile
@del <path to profile>\downloads.rdf
)

script to do individual daily backups of a critical file

rem replace <path to place backups> with where the file copies should be saved
@call getbootinfo detail noshow
@if %bootcount%. == . @(
@rem save one copy for each day of the week
@copy critical.file <path to place backups>\critical_%bootday%.file
)