Solved

How to schedule a task for every 10 seconds

Posted on 2009-04-01
16
4,867 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 76

Expert Comment

by:arnold
Comment Utility
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
Comment Utility
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
Comment Utility
I have Vb script and I want for every 10 seconds.
0
 
LVL 2

Expert Comment

by:Eric_Tanney
Comment Utility
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
Comment Utility
I am familiar with Vb script can you give me a sample code to do that
0
 
LVL 76

Expert Comment

by:arnold
Comment Utility
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
Comment Utility
it takes few seconds when i manually run the script
0
 
LVL 76

Expert Comment

by:arnold
Comment Utility
Does it really need to run every 10 seconds? Will every 60 seconds/ 1 minute be good enough?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Author Comment

by:SGUDAPAT
Comment Utility
I need to run it every 10 seconds.
0
 
LVL 76

Expert Comment

by:arnold
Comment Utility
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
Comment Utility
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
Comment Utility
how can I can stop it to run I want to
0
 
LVL 2

Expert Comment

by:Eric_Tanney
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks a lot
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Many admins will agree: WSUS is is a nice invention but using it on the client side when updating a newly installed computer is still time consuming as you have to do several reboots and furthermore, the procedure of installing updates, rebooting an…
Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
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…

771 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

10 Experts available now in Live!

Get 1:1 Help Now