In a windows batch file (x.bat), how can I fire a command once every 30 minutes, when the second component of the time is greater than 55?
What I have now is:
:loop
program.exe
PING localhost -n 1800 >NUL
goto loop
The problem is that the timing is not precise enough, ie. sec>55 at min%30==29.
As mentioned, Task Scheduler is more than capable for this task. It can be run daily, every 30 minutes starting at next hour:59:55
That said, there are ways to script these things. This is not the most robust solution, but it works.
@echo off
:start
for /f %%i in ('powershell Get-Date -Format mm:ss') do (
if "%%i"=="29:55" program.exe
if "%%i"=="59:55" program.exe
timeout 1 /nobreak>nul
)
goto start