How to schedule a task for every 10 seconds

How can I schedule a task for every 10 seconds. My OS is Windows XP
LVL 1
SGUDAPATAsked:
Who is Participating?
 
Eric_TanneyConnect With a Mentor Commented:
6000 = 6,000 milliseconds (6 seconds)

10000 milliseconds is 10 seconds, 5000 is 5 seconds.

Glad you got it working!!!
0
 
arnoldCommented:
What is the task, you may be able to use the AT command.
I.e. your schedule an at command.  Once the task runs it schedules the next one for 10 seconds later and performs the task. But I do not think even with at you can run every 10 seconds.  I think a minute is fastest frequency.

If you need a task to run this frequently, you should setup a service.
0
 
Eric_TanneyCommented:
Windows Scheduler only works on the hour/minute level. Therefore, if you need to run something every 10 seconds, your on your own with a script.

Depending on what you want to do, you can write a quick .BAT file to run the task, ping a invalid server (will create about a 10 second delay), then run the task again and so on in a loop format. If you know VB script, that would be the best way to go, though.
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
SGUDAPATAuthor Commented:
I have Vb script and I want for every 10 seconds.
0
 
Eric_TanneyCommented:
So write the 10 second loop into the VB Script. Schedule the task to run once a day, let your script do the rest.
0
 
SGUDAPATAuthor Commented:
I am familiar with Vb script can you give me a sample code to do that
0
 
arnoldCommented:
This is more of a service than a task.
I.e. setup the process as a service. and have a sleep 10 to let the thing pause.
how long does the task take to complete processing?

Minutes not seconds can be used to have the task run again:
http://www.petri.co.il/forums/showthread.php?t=20024
0
 
SGUDAPATAuthor Commented:
it takes few seconds when i manually run the script
0
 
arnoldCommented:
Does it really need to run every 10 seconds? Will every 60 seconds/ 1 minute be good enough?
0
 
SGUDAPATAuthor Commented:
I need to run it every 10 seconds.
0
 
arnoldCommented:
Add to your script a loop that will run the task 5 times with a few seconds of delays.  Schedule the vbscript task to run every minute.
0
 
Eric_TanneyCommented:
Here is a loop method you can write in your script. Adjust as need be...
Dim Msg
 
Msg = "Loop"
 
i = 0
 
Do While i = 0
Msgbox Msg
Wscript.Sleep (6000)
Loop
 
You can increase the value = 6000 to match your needs

Open in new window

0
 
SGUDAPATAuthor Commented:
how can I can stop it to run I want to
0
 
Eric_TanneyCommented:
You can either kill the process, or write an override in the VBS to prompt a kill command. Ex. MSGBOX... Kill script (y/n?), type in yes, the script will die. If you don't input anything, it will still be running every ten seconds in the background. You have to finesse this a little bit to make it work to your liking.
0
 
SGUDAPATAuthor Commented:
i got it working thanks,one last question what does value = 6000 equal to? how many seconds is it ? how do we calculate that , let me say if i want it for every 5 seconds, how can change that?
0
 
SGUDAPATAuthor Commented:
Thanks a lot
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.