Solved

How to schedule a task for every 10 seconds

Posted on 2009-04-01
16
5,284 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 78

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 78

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 78

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
 
LVL 1

Author Comment

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

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: I have always been a big fan of Windows but my liking towards it is slowly being eroded by the variety of other Applications that I encounter, when I browse the Web. Most of the software available is free and maybe Open Source too. …
This article covers how to install the Microsoft Windows Operating System (OS). What is covered in this article:  > Different Versions and Editions of the Windows OS  > Upgrading versus Fresh Installation of the OS           - Steps to take pr…
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). …
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…

685 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