Solved

How to schedule a task for every 10 seconds

Posted on 2009-04-01
16
5,189 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

by Nathan Brom/Bromy2004 Introduction There are numerous websites out there for any different type of program you can imagine.  Of those, you'll need to decide which ones are legitimate and aren't trying to steal your money or infect your comput…
Many times while working on a computer regardless of any Operating System, lag and crashes seem to creep in, hindering your working speed. Sometimes, it can also cause your work to be lost unexpectedly and as a result, you are unable to meet your de…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
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…

809 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