Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scheduled Task for every .30 seconds

Status
Not open for further replies.

M626

Programmer
Mar 13, 2002
299
Is there a ways to schedule a Task Using the Windows Scheduled Task to run every 30 seconds?
 
Not that I'm aware of... so why not use a batch file with the SLEEP command?


for example:

Code:
@echo off
sleep 30
start batchfilename
CommandToExecute

I haven't tested it, but it should wait 30 seconds, then start the same batch file again, then execute the command you want executed. We sleep before executing and start the batch file again to ensure that however long it takes your program to run doesn't delay things and make them take more than 30 seconds.
 
I don't think that the windows scheduler can get that granular, but you could kick off a VBscript once a day that has a loop in it to run the command 2880 times... Like this:

Code:
Option Explicit

Dim ctr, intReturn, objShell, strCommand

Set objShell = CreateObject("WScript.Shell")

ctr = 0
strCommand = "copy c:\*.txt \\server\share\copyfolder"

Do
	ctr = ctr + 1
	intReturn = objShell.Run(strCommand, , True)
	WScript.Sleep 30000
Loop Until ctr = 2880

This assumes of course that the command runs almost instantly. You may have to tweak how long it sleeps to ensure you don't overlap one day's script with another.
Hope this helps...

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top