Batch file to open a file periodically

November 13, 2009 at 10:26:17
Specs: Windows XP
I am wanting to create a batch file that will open another file every 15 minutes or so. I know of the countdowns, but thats as long as the batch file is active and wanting to complete a task.. so how I would create a batch file that would open another document every 15 minutes?

See More: Batch file to open a file periodically

Report •

November 13, 2009 at 14:40:03
if your system is running task scheduler (schtasks.exe), I would use "at" command to run your batchfile, and put a 15-minute timer advance into the batchfile, something like:

setlocal enablededlayedexpansion
:first do your file-open test here
if exist myfile (
echo yes the file is there
:use for-loop etc. if need to read the file here)
:now advance timer 15 minutes
set tm=%time%
set hr=!tm:~0,2!
set mn=!tm:~3,2!
set /a mn+=15
if !mn! geq 60 (
set /a mn-=60
set /a hr+=1
if !mn! leq 9 set mn=0!mn!
if !hr! equ 25 set hr=00)
set newtime=!hr!:!mn!:00
:and last set "at" to re-exec the batch at new time
at !newtime! "test.bat"

Report •
Related Solutions

Ask Question