Ben*_*est 6 vbscript windows-installer setup-project
我有一个我写的VBScript需要从MSI文件执行.当我在Windows中独立运行脚本时,脚本会正确执行,但是,当我从安装程序运行它时,我会收到以下错误,如日志文件中所示:
Microsoft VBScript runtime error: object required: 'WScript', Line 3, Column 2
Run Code Online (Sandbox Code Playgroud)
脚本如下:
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
Run Code Online (Sandbox Code Playgroud)
如前所述,如果我在安装程序的上下文之外运行它,则此脚本运行正常.安装项目类型是VS2010安装和部署包(这是客户希望使用的,我不能使用任何其他东西).有任何想法吗?
在"shell"子句中,我在调用"CreateObject()"之前从第一行中删除了WScript.修改后的行现在看起来像这样:
'Note the absent reference to WScript on the call to CreateObject()
Set objShell = CreateObject("WScript.Shell")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8092 次 |
| 最近记录: |