VBScript will not execute correctly from MSI file

I have a VBScript that I wrote that should be executed from an MSI file. The script runs correctly when I run it inside Windows myself, however, when I run it from the installer, I get the following error, as shown in the log file:

Microsoft VBScript runtime error: object required: 'WScript', Line 3, Column 2

the script is below:

sub shell(cmd)
    Set objShell = WScript.CreateObject("WScript.Shell")

    objShell.Run("""" & cmd & """")
    Set objShell = Nothing
end sub

set objFSO = CreateObject("Scripting.FileSystemObject")

strcmd32 = "C:\Path\PathToExecutable.exe"
strcmd64 = "C:\Path\PathToExecutable64.exe"

if (objFSO.FileExists(strcmd32)) then
    shell(strcmd32)
else 
    shell(strcmd64)
end if

set objFSO = Nothing

As stated above, this script works fine if I run it outside the installer context. The type of installation project is the VS2010 installation and deployment package (this is what the client wants to use, and I cannot use anything). Any ideas?

+5
source share
2 answers

"" WScript "CreateObject()". :

'Note the absent reference to WScript on the call to CreateObject()
Set objShell = CreateObject("WScript.Shell")
+7

, , Advanced Installer. , .. "" . .

, , " ", , .

, , , .

+3

All Articles