Solved

How to schedule a task for every 10 seconds

Posted on 2009-04-01
16
4,967 Views
Last Modified: 2012-05-06
How can I schedule a task for every 10 seconds. My OS is Windows XP
0
Comment
Question by:SGUDAPAT
  • 7
  • 5
  • 4
16 Comments
 
LVL 77

Expert Comment

by:arnold
ID: 24040498
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
 
LVL 2

Expert Comment

by:Eric_Tanney
ID: 24040499
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
 
LVL 1

Author Comment

by:SGUDAPAT
ID: 24040574
I have Vb script and I want for every 10 seconds.
0
 
LVL 2

Expert Comment

by:Eric_Tanney
ID: 24040662
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
 
LVL 1

Author Comment

by:SGUDAPAT
ID: 24040674
I am familiar with Vb script can you give me a sample code to do that
0
 
LVL 77

Expert Comment

by:arnold
ID: 24040722
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
 
LVL 1

Author Comment

by:SGUDAPAT
ID: 24040745
it takes few seconds when i manually run the script
0
 
LVL 77

Expert Comment

by:arnold
ID: 24040869
Does it really need to run every 10 seconds? Will every 60 seconds/ 1 minute be good enough?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:SGUDAPAT
ID: 24040901
I need to run it every 10 seconds.
0
 
LVL 77

Expert Comment

by:arnold
ID: 24040965
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
 
LVL 2

Expert Comment

by:Eric_Tanney
ID: 24040987
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
 
LVL 1

Author Comment

by:SGUDAPAT
ID: 24041032
how can I can stop it to run I want to
0
 
LVL 2

Expert Comment

by:Eric_Tanney
ID: 24041081
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
 
LVL 1

Author Comment

by:SGUDAPAT
ID: 24041105
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
 
LVL 2

Accepted Solution

by:
Eric_Tanney earned 500 total points
ID: 24041148
6000 = 6,000 milliseconds (6 seconds)

10000 milliseconds is 10 seconds, 5000 is 5 seconds.

Glad you got it working!!!
0
 
LVL 1

Author Closing Comment

by:SGUDAPAT
ID: 31565334
Thanks a lot
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Log files are useful in diagnosing and repairing problems.  This is a list of common log files and their standard locations that I've compiled.   While this is not exhaustive, it is a pretty good list that I've found to be useful.  I may update it f…
Have you ever had a hard drive that you can't boot into, but need to change the registry? Here is the solution! This article guides you through accessing and editing a registry of a non-primary drive. To read registry information on a non-prim…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now