I would like to run a batch only during a specific time of the day (range).
For instance the idea would be to have have it run from 07:00AM to 06:00PM.
I know that %TIME% returns current time, what’s missing now is a way to check this value and if she’s on the range provided the batch will execute, if not the batch will stop there.
This worked for me (Win7):
You can change
echo helloto anything likegoto okand the next two lines would be for examplegoto endand:ok.Don’t forget to paste it to a batch file or use %a instead of %%a if you try it directly in command prompt.