Discussion Locked

VBScript

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I need to run a VBScript in the backround that will check the date and time and run a bat file at a certain date and time...

this is what I have so far...

Option Explicit

dim MyDate
dim MyTime

stop
MyDate = date
MyTime = time

Do
If MyDate = ##/02/####
then goto next
else goto loop

If MyTime = 12:00a
then goto next
else goto loop

Loop

Run c:\test.bat

End Function

Any suggestions?

5 replies

by steved

Well, I can give you the right syntax for looping until a certain date and time, but I'm darned if I can see a way to run the batch file. "Run c:\test.bat" just isn't going to work. There is no Run statement in vbs.

Here's the loop to wait for a date/time:

Option Explicit
dim MyDate
MyDate = Now
While MyDate < "5/13/01 00:00"
MyDate = Now
Wend

by esadacca

The Task Scheduler and AT service are designed to do just this.

If you're running IE5 or higher, you'll find the Task Scheduler in "My Computer".

If you're running NT (with IE4 or less), run "at /?" at the command prompt; note that you mayneed to start the "Schedule" service.

This discussion is closed to new replies.