如何在VBScript自定义操作中为InstallShield找到安装位置? [英] How to find the setup location in an VBScript custom action for InstallShield?

查看:157
本文介绍了如何在VBScript自定义操作中为InstallShield找到安装位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在InstallShield项目中,我有一个VBScript自定义操作,有条件地需要执行安装过程中打包的某个文件。

In an InstallShield project I have a VBScript custom action that conditionally needs to execute a certain file packaged with the install.

通常,我会得到vbs的当前目录。使用诸如

Normally I get the current directory of a vbs using code such as

sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")

如果它返回了启动安装的Setup.exe的位置,则应该可以。

Which, if it returned the location of the Setup.exe that initiated the install, should work.

但是,当运行安装时,当前路径(在XP上)为C:\Windows\system32,而不是我期望的Setup.exe文件的位置。

However when running the install, the current path (on XP) is C:\Windows\system32 instead of the location of the Setup.exe file I was expecting.

假设我的InstallShield版本的输出如下所示:

Assuming the output of my InstallShield build looks like the following

Disk1
->Setup.exe
->ISSetupPrerequisites
-->Req1
-->Req2
-->...
->OtherReqs
-->ConditionallyRunMe.exe

如何运行 \OtherReqs\ VBScript中的 ConditionallyRunMe.exe

How could I run "\OtherReqs\ConditionallyRunMe.exe" from a VBScript custom action?

谢谢!

(注意:我知道有一些方法可以有条件地从带有InstallShield,但在这种情况下,InstallShield不支持这些要求-除非有一种方法可以使用VBScript自定义操作返回值作为运行另一个文件的条件?)

(Note: I realize there are ways to conditionally run exe files from withing InstallShield, but in this case the requirements are not supported by InstallShield - unless there is a way to use a VBScript custom action return value as a condition to run another file?)

推荐答案

经过一番混乱,我明白了(实际上是在InstallShield手册中找到的,而不是Google的,请看图:))!

After a lot of messing around, I got it (actually found it in the InstallShield manual, and not Google, go figure :))!

这行VBScript可以解决问题

This line of VBScript does the trick

disk1Path = Session.Property("SETUPEXEDIR")

上面的行指向安装exe文件所在的位置,因此从

The line above points to where ever the setup exe file was, so from there it's trivial to run any exe included with your install media.

我发现其他有用的东西,我将在这里作为参考

Other useful ones I found, which I'll past here for reference are

'points to app data\downloaded install directory
MsgBox Session.Property("SourceDir")
'where the software wants to install to on the users system
MsgBox Session.Property("INSTALLDIR")

不确定为什么很难在MSI标准属性上找到好的参考文献(甚至只是列表)。我找到的最接近的,但并非所有这些都可以使用(而且并非专门针对InstallShield) )。如果有人找到与MIS Standard属性及其描述有关的文档的良好链接,请在此处添加链接,这样就没有人像我那样浪费太多时间了:)。

Not sure why it's so hard to find a good reference on MSI Standard properties (even just a list). The closest I found was this, but not all of them work (and not specifically for InstallShield at all). If anyone finds a good link with documentation about MIS Standard properties and their description please add a link here, so no one has to waste as much time on this as I did :).

这篇关于如何在VBScript自定义操作中为InstallShield找到安装位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆