This will work under the assumption that is called when the machine boots.
wevtutil is used to search the
System event log for the last two Startup events (
EventID=12) and from them the date is extracted. If both dates are the same, then this is not the first startup today.
setlocal enableextensions disabledelayedexpansion
for /f "tokens=2 delims=T: " %%a in ('
wevtutil qe system /count:2 /rd:true /q:"Event[System[(EventID=12)]]" /format:text
^| find "Date:"
') do if not defined boot1 ( set "boot1=%%a" ) else ( set "boot2=%%a" )
if "%boot1%"=="%boot2%" (
echo This is NOT the first boot on the current day
) else (
echo This IS the first boot on the current day