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

How to run programs sequentially? 2

Status
Not open for further replies.

Jaws25

IS-IT--Management
Joined
Sep 4, 2003
Messages
11
Location
US
I have a need to run programs sequentially. I can get them to launch all at the same time but that is confusing an cumbersome. I would like to have the second .exe file launched when the first .exe file is done running/installing.

PS. I am newer to vbscripting. Just finished a 3 day class and have been writing very small scripts.

This is what I have that will launch 1 (or more at the same time)

-----------
Dim wshshell
Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run "c:\windows\notepad.EXE"
-----------

I know that "notepad.exe" isn't a great example since it just pops up and doesn't actually try to install anything.
 
Try this for each program you need to run

Set Running = WshShell.Exec("program and parameters")

Do While Running.Status = 0
WScript.Sleep 10000 'wait ten seconds
Loop
it will wait for the program to finish then start the next one just loop all your programs in an array
 
Thanks Spazman! Its doing what I need. I'm working on the array right now. Thanks again!
 
You can also just do something like this:
Code:
WshShell.Run "c:\windows\notepad.EXE",1,True



Hope This Help
PH.
 
i'm trying to do the same with this
Dim wshshell
Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.Run "W:\harrisoj\jcltest.exe"

i'm getting a runtime error -

error: Object required 'wscript'

the debugger is pointing to the set...HELP!!!
 
In the following example the true statement keeps the
script from continuing till the progran is exited.
Enjoy Bob

Set ss = CreateObject("WScript.Shell")
ss.run "C:\RMCOBOL\RUNCOBOL.EXE C:\COBOLTEST",1,true
set ss = nothing

returncode=msgbox ("mount a 3.5 diskette for backup",65,"backup start")
if returncode=1 then
Set ss = CreateObject("WScript.Shell")
ss.run "COMMAND /C pkzip.exe a:file.zip file.txt",1,TRUE
set ss = nothing
msgbox "backup is done please remove the diskette",64,"backup finished"
end if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top