Richard
Fri Jun 09 19:39:04 CDT 2006
Actually, the syntax used by cmyers is correct. Using a value of 1 for the
second argument of the Run method means the program runs in a normal window.
I often use 0 which means it runs hidden. True for the third argument means
the script waits for the program to complete before continuing, which is
necessary if we hope to get a return code. The default is False, which means
the script continues immediately and never gets a return code.
In this case either setup.exe does not supply a return code, or (more
likely) setup.exe launches another program that actually installs. The
script sees that setup.exe run successfully, but not that the child process
failed.
The best solution might be to introduce a pause in the script (to give the
child process time to complete) using Sleep, then test for something the
install adds to the computer. You could test for the existence of a file or
check for a registry setting added by the install. Perhaps something similar
to:
intCount = 0
Do Until intCount = 30
' Pause 1 second.
Wscript.Sleep 1000
' Check for existence of a file.
If objFSO.FileExists(strPath) Then
Exit Do
End If
intCount = intCount + 1
Loop
I like to make sure I don't get in an infinite loop, so the above will pause
for max 30 seconds then give up. Whatever you test for, a file or registry
setting, should be something done near the completion of the install. I hope
this helps.
--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab -
http://www.rlmueller.net
"W C Hull" <substitute1stInitial2ndInitialLastName51@hotmaill.com> wrote in
message news:uHWXe7BjGHA.4304@TK2MSFTNGP03.phx.gbl...
> Instead of a 1 in your shell Run I think you need a zero. I believe that
> a 1 says execute but don't wait. Zero says wait until the thread
> completes before continuing.
>
>
> <cmyers@nrao.edu> wrote in message
> news:1149862545.666710.7840@f6g2000cwb.googlegroups.com...
>> Is there a way to test for the successful completion of "setup.exe"
>> using either the exec or run methods? Particularly what I'm trying to
>> do is do a silent install of Firefox & Thunderbird 1.5.0.4. I've
>> extracted their installation files and made the necessary modifications
>> to them, and the "setup.exe" with both of them can be run in silent
>> mode. If I launch that, how can I determine if it completes
>> successfully? The following code seems to always return a zero
>> ReturnCode, regardless of whether setup.exe fails or completes
>> successfully.
>>
>> If Not IsObject(oWshShell) Then Set oWshShell =
>> CreateObject("WScript.Shell")
>> ReturnCode = oWshShell.Run("setup.exe", 1, True)
>>
>>
>> Thanks...
>>
>
>