'Want a .bat file to run during a certain time range
I want to have my .bat file from 9:00 am to 6:00 am the next day. This is my code shown below:
powershell -window minimized -command ""
@echo off
cls
:start
cscript DisplayBoard.vbs "FilePath\macro.xlsm"
goto start
I tried adding the set hours one and the time code but neither one worked with my code. Can someone help?
Update this is the code i tried
powershell -window minimized -command ""
@echo off
SET hour=%time:~0,2%
SET shouldrun=True
IF %hour% geq 9 SET shouldrun=False
IF %hour% leq 6 SET shouldrun=False
IF "%shouldrun%"=="True" (
CALL cls
:start
cscript DisplayBoard.vbs "S:\FilePath\macro.xlsm"
goto start
)
Solution 1:[1]
Best (and easiest) solution would utilize Windows Task Scheduler to run the job on a specified schedule. Triggers, schedule, etc. can be defined within the task configuration.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Cheese |
