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

Run 2 programs in succession in a script

Status
Not open for further replies.

swlymer

Programmer
Dec 15, 2004
10
0
0
US
Hi, I am trying to write a script that runs 1 programs and upon completion runs another program. Here is what I have so far. I would prefer to not use wscript.sleep if at all possible.

**********************************************************

Dim oShell, oEnv
set oShell= CreateObject("Wscript.Shell")
set oEnv = oShell.Environment("PROCESS")
oEnv("SEE_MASK_NOZONECHECKS") = 1
oShell.Run "C:\Oracle10Client\10g_client\setup.exe -responsefile c:\Oracle10client\10g_client\response\10CLIENT.RSP -noconsole -silent", 0,True
oShell.Run "C:\Oracle10Client\10g_client\Patch\Disk1\setup.exe -responsefile C:\Oracle10Client\10g_client\response\10GPATCH.RSP -noconsole -silent",0,True
oEnv.Remove("SEE_MASK_NOZONECHECKS")

**********************************************************

Thanks!!
 
What doesn't happen that you're expecting to happen or what happens that you're not expecting.
 
I want this command (Command A) to run

oShell.Run "C:\Oracle10Client\10g_client\setup.exe -responsefile c:\Oracle10client\10g_client\response\10CLIENT.RSP -noconsole -silent", 0,True

and once completed I want this command (Command B)to run

oShell.Run "C:\Oracle10Client\10g_client\Patch\Disk1\setup.exe -responsefile C:\Oracle10Client\10g_client\response\10GPATCH.RSP -noconsole -silent",0,True

Command B starts before Command A is finished which causes the entire installation to fail.

Thanks for your help!!

Scot

 
Use WSHSHell.Exec instead of WSHShell.Run. That way you can capture the output of the program using Wscript.StdOut in conjunction with a Do While to watch for program completion.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Mark, I doubt there is any output to capture wich such command line options: -noconsole -silent
 
good eye PHV, I did not catch that. Thanks for keeping me honest.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Try this.
strCommand = "C:\Oracle10Client\10g_client\setup.exe -responsefile c:\Oracle10client\10g_client\response\10CLIENT.RSP -noconsole -silent"

InstallThis strCommand
strCommand = "C:\Oracle10Client\10g_client\Patch\Disk1\setup.exe -responsefile C:\Oracle10Client\10g_client\response\10GPATCH.RSP -noconsole -silent"

InstallThis strCommand

Function InstallThis(ByVal SomeCommand)

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
intReturn = objWMIService.Create(SomeCommand, null, null, intProcessID)
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colProcesses = objWMIService.ExecNotificationQuery _
("Select * From __InstanceDeletionEvent " _
& "Within 1 Where TargetInstance ISA 'Win32_Process'")

Do Until i = 999
Set objProcess = colProcesses.NextEvent
If objProcess.TargetInstance.ProcessID = intProcessID Then
wscript.echo "Start next process "
Exit Do
End If
Loop
End Function







 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top