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

How do I make the script pause??

Status
Not open for further replies.

GCFII

IS-IT--Management
May 17, 2004
20
US
I am still a newbie a VBScripting but I am trying to build a script that will install Office XP Sp3 and the 4 post SP3 patches. The script seems to work except it does not wait for the 1st command to complete before moving on to the next and so on thus making it fail. Is their a something i can add/change in my script below to make it wait till one process finishes before proceeding?

Set Wshshell=CreateObject("WScript.Shell")

WshShell.run """\\myserver\patches\office\OfficeXpSP3\exFullfile\ohotfix.exe"""

'a.close

Set Wshshell=CreateObject("WScript.Shell")

WshShell.run """\\myserver\Patches\Office\KB873379\ohotfix.exe"""

'a.close

Set Wshshell=CreateObject("WScript.Shell")

WshShell.run """\\myserver\Patches\Office\MS04028\ohotfix.exe"""

'a.close

Set Wshshell=CreateObject("WScript.Shell")

WshShell.run """\\myserver\Patches\Office\KB833858\ohotfix.exe"""

'a.close

Set Wshshell=CreateObject("WScript.Shell")

WshShell.run """\\myserver\Patches\Office\KB837253\ohotfix.exe"""

'a.close

As always, Thx
 
try WshShell.Run hotfix.exe, 1, True

the True means it should wait for the thread/process to finish before the script continues.

 
hmm on this note i think you will find that m$ provide a method of changing patches using a ohotfix.ini file i believe.
 
mrmovie, can you be a liitle more specific. I am not sure what exactly to change from your first reply. Are you suggesting that I just add , 1, True to the end of what I already have? like this:

Set Wshshell=CreateObject("WScript.Shell")

WshShell.run """\\myserver\Patches\Office\KB837253\ohotfix.exe""", 1, True

or is that wrong? Sorry but I am faily new at this.

As far as the m$ i am not familiar with this method where can I find some examples?

Thx
 
yes, thats what i am suggesting. i will stick my neck out and say i think it will work.

have a look at M$ site for the installing of ohotfixes, i read something last week about chaining hotfixes. i didnt go the m$ way in the end but its there if you want it

 
Description
Creates a new process that executes strCommand.

Syntax
object.Run (strCommand, [intWindowStyle], [bWaitOnReturn])

Parameters

strCommand
Environment variables within the strCommand parameter are automatically expanded.

intWindowStyle Optional.
Sets the window style of the program being run.

bWaitOnReturn Optional.
If bWaitOnReturn is not specified or FALSE, immediately returns to script execution rather than waiting for the process to end.
If bWaitOnReturn is set to TRUE, the Run method returns any error code returned by the application.
If bWaitOnReturn is not specified or is FALSE, the Run method returns an error code of 0 (zero).

 
GCFII,

Try this...
'Wait 5 seconds
wscript.sleep 5000


Hope this helps.
Carl


AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top