我正在编写一个自定义脚本来安装我的安装程序,以便用户可以选择安装工具栏。这是布局的样子:
http://i47.tinypic.com/2v92csl.png
随附的代码:
' Set Executable
Set WshShell = CreateObject("WScript.Shell")
' Set booleans for what features to enabled/disable
Dim Feature1 As Boolean
Dim Feature2 As Boolean
Dim Feature3 As Boolean
Dim Feature4 As Boolean
Feature1 = False
Feature2 = False
Feature3 = False
Feature4 = False
If Session.Property("RADIO") = "RadioFeatureA" Then
Feature1 = True
Feature2 = False
ElseIf Session.Property("RADIO") = "RadioFeatureB" Then
Feature2 = True
Feature1 = False
End If
' Set the checkbox1 feature if ticked
If Session.Property("CHECK1") = "install" Then
Feature3 = True
Else
Feature3 = False
End If
' Set the checkbox2 feature if ticked
If Session.Property("CHECK2") = "install" Then
Feature4 = True
Else
Feature4 = False
End If
' Execute the file
If Feature1 = True Then
WshShell.Run (""APPDIR\file.exe"" /SILENT /INSTALL)
ElseIf Feature2 = True And Feature3 = True Then
WshShell.Run (""APPDIR\file.exe"" /SILENT)
ElseIf Feature2 = True And Feature4 = True Then
WshShell.Run (""APPDIR\file.exe"" /SILENT)
ElseIf Feature2 = True And Feature3 = True And Feature4 = True Then
WshShell.Run (""APPDIR\file.exe"" /SILENT /INSTALL)
End If
但由于某种原因,安装程序崩溃了。代码看起来很好,并在外部执行?
答案 0 :(得分:2)
我怀疑当您尝试启动exdcutable时会发生崩溃。原因可能是多种多样的,例如UAC权利。但是whar引起了我的注意,你是如何使用APPDIR属性的。你应该首先在一个单独的变量中获取它的值,然后追加。变量的可执行文件名,以获取正确的路径。
但是,这仍然无效,因为我假设您使用由MSI对话框上的操作触发的已发布事件启动脚本,即在安装文件之前,因此您的可执行文件不可用。
从屏幕截图中我假设您使用Advanced Installer,因此您有两种方法可以解决您的问题: