获取目录设置安装盾 [英] Get dir setup install shield

查看:108
本文介绍了获取目录设置安装盾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过安装盾获得我的安装程序创建的目录. 我使用命令参数Setup.exe /path=[SETUPEXEDIR]\log.txt 我的设置位置是Desktop\myapp\Setup.exe 使用[SETUPEXEDIR]时返回临时文件夹 我想在使用[SETUPEXEDIR]时返回我的Setup.exe位置.

I want get dir my setup create by install shield. I use command parametter Setup.exe /path=[SETUPEXEDIR]\log.txt My setup location is Desktop\myapp\Setup.exe When use [SETUPEXEDIR] return temp folder I want when use [SETUPEXEDIR] return me my Setup.exe location.

我使用installshield 2016版本23 SP 2. 我使用MSI脚本.

I use installshield 2016 version 23 SP 2. I use MSI Script.

我想获取位置并在命令参数先决条件中使用.

I want get location and use in command parameter prerequisites.

推荐答案

要确切地理解您的要求有点困难,但是据我了解,您想知道setup.exe运行所在的位置?

A little hard to comprehend exactly what you are asking, but as far as I understand you want to know the location where setup.exe is running from?

  • 第一个问题是:您使用的是什么 Installshield版本?

  • The first question is: what version of Installshield are you using?

第二个问题是:您正在使用 Basic MSI 还是 Installscript MSI ?

第三个问题是:您正在使用哪种类型的发布媒体?

可能还有更多相关问题...

There may be more relevant questions...

明智的话:如果您确实在使用Installscript MSI,则应该知道这是一个非常有漏洞的项目类型,并且应该认真考虑改用Basic MSI来避免痛苦.如果您愿意,我可以提供更多信息.我不得不完全放弃Installscript MSI,以消除部署问题.

A word to the wise: if you are indeed using Installscript MSI you should know that it is a very buggy type of project, and you should seriously consider switching to Basic MSI to save yourself grief. I can provide more information on this if you like. I had to abandon Installscript MSI entirely to make my deployment problems go away.

似乎不同版本的Installshield的行为可能有所不同,并且对这些文件夹属性/变量的支持功能也有所不同.似乎该属性可能不适用于所有类型的发行媒体.最后,它们可能分别只能在Basic MSI或Installscript MSI中工作.我找到的属性是: PACKAGE_LOCATION > SETUPEXEDIR SRCDIR .似乎还有一个名为 GetCurrentDir() 在最新版本的Installshield中可用,但文档警告使用它(请参阅链接).

It seems different versions of Installshield may behave differently and feature varying support for these folder properties / variables. It also seems the properties may not work with all types of release media. And finally they may only work in Basic MSI or Installscript MSI respectively. The properties I have found are: PACKAGE_LOCATION, SETUPEXEDIR and SRCDIR. There also appears to be an Installscript method called GetCurrentDir() available in recent versions of Installshield, but the documentation warns about using it (see link).

请依次访问上面的链接,并详细了解每个属性(或方法)的局限性.使用与需求和方案相匹配的选项(如果有)非常重要.例如,PACKAGE_LOCATION仅适用于Installscript MSI,SETUPEXEDIR由Setup.exe设置.如果最终用户直接运行.msi程序包,则未设置SETUPEXEDIR.

Please visit the links above in sequence and read in detail about each property's (or method's) limitations. It is very important that you use the option (if any) that matches your requirements and scenario. For example PACKAGE_LOCATION works only for Installscript MSIs, SETUPEXEDIR is set by Setup.exe. If the end user runs the .msi package directly, SETUPEXEDIR is not set.

在我看来,获得内置MSI属性

It seems to me that getting the built-in MSI property SourceDir might be an option to try. My quick test indicates that it works for both InstallScript and Basic MSI. However, I do not know if this works for all versions of Windows Installer. Please test on various Windows versions to be sure.

您还应该注意使用SourceDir的潜在问题,该问题在 中进行了描述> SETUPEXEDIR的文档 .这适用于编译成包含所有文件的单个压缩setup.exe的安装程序-此启动器会将MSI文件提取到临时位置并从那里运行.当我尝试使用未压缩的网络映像时,使用SourceDir可以正常工作.

You should also be aware of the potential problem using SourceDir which is described in the documentation for SETUPEXEDIR. This goes for setups that are compiled into a single, compressed setup.exe containing all files - this launcher will extract the MSI file to a temp location and run from there. When I tried with an uncompressed network image it worked fine to use SourceDir.

最后,如果您使用setup.exe压缩所有文件并启用系统上MSI的缓存,那么您将在C:\WINDOWS\Downloaded Installations\{GUID}\内部运行.

Finally, if you use a setup.exe to compress all files and enable the caching of the MSI on the system, then you will be running from somewhere inside: C:\WINDOWS\Downloaded Installations\{GUID}\.

在更高版本的Installshield中,所有这些可能都不同.我正在使用可用的旧版本进行测试.请在您的版本上进行彻底的测试.

All of this could be different on newer versions of Installshield. I am testing with an ancient version I have available. Please test thoroughly on your version.

我还应该提及 原始数据库 内置MSI属性.检查链接以获取有关如何设置它的文档.

I should also mention the OriginalDatabase built-in MSI property. Check the link for documentation on how it will be set.

一些链接:

  • Installscript project - Get Setup.exe location.
  • How to find the setup.exe directory?

这里仅供参考,这是一个快速且肮脏的功能,可通过Installshield自定义操作测试这些属性(这适用​​于其他人,他们可能没有经过与您相同的测试就发现了此属性):

And just for reference, here is a quick and dirty function to test these properties from an Installshield custom action (this is for other people who may find this without having tested as much as you):

function TestFolderProperties(hMSI)   
     STRING svName;
     NUMBER nvSize;
begin             

    // MSI properties
    nvSize = 256;
    MsiGetProperty (hMSI, "SETUPEXEDIR", svName, nvSize);
    MessageBox ("SETUPEXEDIR: " + svName, INFORMATION);
    MsiGetProperty (hMSI, "SourceDir", svName, nvSize);
    MessageBox ("SourceDir: " + svName, INFORMATION);
    MsiGetProperty (hMSI, "OriginalDatabase", svName, nvSize);
    MessageBox ("OriginalDatabase: " + svName, INFORMATION);

    // System Variables
    MessageBox ("SRCDIR: " + SRCDIR, INFORMATION);
    // PACKAGE_LOCATION is not available in my version of Installshield, enable and test 
    //MessageBox ("PACKAGE_LOCATION: " + PACKAGE_LOCATION, INFORMATION);
end;

请记住将导出添加到setup.rul文件的顶部:

Remember to add the export to the top of the setup.rul file:

export prototype TestFolderProperties(HWND);  

测试编译以进行验证,然后创建一个Installscript自定义操作并将其放入序列中.使自定义操作的返回处理"同步(忽略退出代码).我使用立即模式执行将其放在序列的InstallFinalize之前.重建您的发行版并运行它.尝试不同的发行版本配置(带有外部源文件的msi,仅带内部压缩文件的MSI,带外部文件的setup.exe启动器,带内部所有压缩文件的setup.exe,带缓存的setup.exe,不带缓存的setup.exe等). ..行为可能有所不同).

Test compile to verify, and then create an Installscript custom action and put it in a sequence. Make "Return Processing" Synchronous (Ignores exit code) for the custom action. I put it right before InstallFinalize in the sequence, using immediate mode execution. Rebuild your release and run it. Try different release build configurations (msi with external source files, MSI only with compressed files inside, setup.exe launcher with external files, setup.exe with all files compressed inside, setup.exe with caching, setup.exe without caching, etc... the behavior might be different).

这篇关于获取目录设置安装盾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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