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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scheduling wscript.shell runs

Status
Not open for further replies.

blpcrs

Programmer
Aug 25, 2011
19
US
Hi, I am looking to run 1 or more tasks from a User Form interaction that will run either now, or at a specified time. I'm not sure the onTime facitlity will work for this.

For immediate run, I have code that contains:
Set objShell(x) = CreateObject("wscript.shell")

For x = 0 To numShells
For yy = 0 To numTasks - 1
If taskSet(yy).host = targetHosts(x) Then
objShell(x).Run taskSet(yy).RunScript, 1, False
End If
Next yy 'taskset
Next x 'shell

Where RunScript will launch a cmd window and perform some tasks with parameters specified by the user. (the basics of the loop are that it will be sending commands to different hosts, if the hosts are the same, the tasks will send one after another, rather than at the same time. If they are to different hosts, they will fire concurrently.

I can't seem to come up with a way to have this done given a specified time. Please help, Thank you in advance to everyone!
-chris





 
Would a possible solution to this be to write the shell scripts into the body of a VBScript, and then use schtasks to run it at a later time?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top