Avatar of jaldinger
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.
Windows Server 2003

Avatar of undefined
Last Comment
jaldinger

8/22/2022 - Mon
SOLUTION
TheCleaner

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER CERTIFIED SOLUTION
ryangorman

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
jaldinger

ASKER
Thanks everybody, after some consideration I used the following VBScript to accomplish what I wanted:

Set WshShell = WScript.CreateObject("WScript.Shell")
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.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy