jaldinger
asked on
Schedule tasks to run more frequently than once per minute
Hello,
I'm trying to schedule a task to run every 15 or 30 seconds. It's a quick and easy polling task that usually only takes 1 second to complete, 5 at most if any service fails. I've been using SCHTASKS to schedule it to run every minute, but have been unable to increase the interval to something less than a minute. Here's what I've been trying, which does not work because it sets the task to run every full minute anyway, regardless of the 15 second setting in the start time:
C:\>schtasks /create /tn "Service Monitor xx_xx_15" /tr "service-monitor.exe" /sc MINUTE /st 10:10:15
When I submit the above command the task gets scheduled for 10:10:00, as you can see here:
C:\>schtasks /query
...
Service Monitor xx_xx_15 10:10:00 AM, 9/14/2006
...
Please help! Thank you!
Joerg.
I'm trying to schedule a task to run every 15 or 30 seconds. It's a quick and easy polling task that usually only takes 1 second to complete, 5 at most if any service fails. I've been using SCHTASKS to schedule it to run every minute, but have been unable to increase the interval to something less than a minute. Here's what I've been trying, which does not work because it sets the task to run every full minute anyway, regardless of the 15 second setting in the start time:
C:\>schtasks /create /tn "Service Monitor xx_xx_15" /tr "service-monitor.exe" /sc MINUTE /st 10:10:15
When I submit the above command the task gets scheduled for 10:10:00, as you can see here:
C:\>schtasks /query
...
Service Monitor xx_xx_15 10:10:00 AM, 9/14/2006
...
Please help! Thank you!
Joerg.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Set WshShell = WScript.CreateObject("WScr
For i = 0 to 3
WshShell.Run ("service-monitor.exe")
WScript.Sleep(15000)
Next
This has the advantage over the batch file that it'll execute the script more precisely in time, because it won't wait for the program to finish and return. I'll split the points between the both of you. Thank you.