I tried setting up a task using Task Scheduler to run:
Every 5 minutes from 6:26 PM for 1 hours(s) every day, starting
10/6/2008 and ending 9/7/2009.
But this ran once and that was it.
Any ideas?
What duration did you set?
You can use the command line task scheduler (watch for wrapping):
schtasks.exe /Create /TN "My Task" /TR "C:\Test.vbs" /RU System /SC Minute
/MO 5
Quite a solution.
I need to run it on three tasks:
For task one:
0,5,10,15,20,25,30,35,40,45,50,55
For task two:
1,6,11,16,21,26,31,36,41,46,51,56
And task three:
2,8,12,17,22,27,32,37,42,47,52,57
So how do I set up the start time to get this to happen?
Thanks!
One hour.
What does duration refer to? What should it be?
Thanks.
You can use the '/ST' switch to specify a start time. Modifying the
original example to have it start at 4 PM:
schtasks.exe /Create /TN "My Task" /TR "C:\Test.vbs" /RU System /SC Minute
/MO 5 /ST 16:00:00
You can type 'schtasks.exe /Create /?' at the command prompt to get the
syntax and a listing of the switches.
For your examples above, just start task one at the beginning of the
hour (/ST 16:00:00), task two at one minute past (/ST 16:01:00) & task three
for two minutes after (/ST 16:02:00). Modify for your preferred starting
hour...
<gimme_this...@yahoo.com> wrote in message
news:f733cf48-1519-45e4...@k36g2000pri.googlegroups.com...
> Wow James.
>
> Quite a solution.
>
> I need to run it on three tasks:
>
> For task one:
>
> 0,5,10,15,20,25,30,35,40,45,50,55
what are these numbers? offsets in minutes from 6:26? Is this task supposed
to start at 6:26, 6:31, 6:36, and etc? how long will each instance run
before it stops running? If more than 5 minutes, each of those will need to
be scheduled separately.
/Al
If it starts on october 6th it is already finished, as september 7th is long
past.
/Al
--
Regards,
Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
I'm not sure if this is what you are after but give it a try and let us
know.
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim begin, mystop, endtime, last, current
begin = #6:26 PM#
mystop = #7:26 PM#
endtime = #9/7/09 7:26 PM#
last = Minute(Now) - 1 'prime the pump
Do
Current = Now
If current > endtime Then
Wscript.Echo current & " is after " & endtime
Exit Do
ElseIf TimeValue(current) > Begin And _
TimeValue(current) < mystop Then
If last = Minute(current) Then
Wscript.Sleep 5000
Else
Select Case Minute(current)
Case 0,5,10,15,20,25,30,35,40,45,50,55
Wscript.Echo "Task1" '<=== .run Task1 here
Case 1,6,11,16,21,26,31,36,41,46,51,56
Wscript.Echo " Task2" '<=== .run Task2 here
Case 2,8,12,17,22,27,32,37,42,47,52,57
Wscript.Echo " Task3" '<=== .run Task3 here
End Select
last = Minute(current)
End If
Else
Wscript.Sleep 60000 'wait a minute.
End If
Loop
--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)
<gimme_this...@yahoo.com> escribió en el mensaje de
noticias:22a9f77a-7be2-4674...@a3g2000prm.googlegroups.com...
Your suggestions worked for me.
Yes - it wasn't what I wanted.
But I think it's cool how it works. With your script I don't have to
schedule the tasks.
Also I've never saw Minute and TimeValue before.
On Oct 7, 9:13 pm, "Todd Vargo" <tlva...@sbcglobal.netz> wrote:
> (Post questions to group only. Remove "z" to email personal messages)- Hide quoted text -
>
> - Show quoted text -
--
Regards,
Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
Download script56.chm from the Microsoft site.