The reason your script is not working is the time until 10 a.m. When the time is less than 10, the% Time% variable returns this format: " H:MM:SS:ss" . However, when 10 or later returns the variable %Time% : "HH:MM:SS:ss" .
Note the missing 0 at the start of the time before 10 . This causes a comparison problem because the package performs string comparisons rather than numerical comparisons.
07:00 less than 6:00 because ASCII 6 greater than ASCII 0 .
The solution requires you to add zero to the beginning of the time if it is before 10 in the morning.
Just change
set currentTime=%TIME%
IN
set "currentTime=%Time: =0%"
This will replace any spaces beyond zero.
David ruhmann
source share