如何强制Inno Setup动态设置安装文件夹 [英] How to force Inno Setup to set the installation folder dynamically

查看:170
本文介绍了如何强制Inno Setup动态设置安装文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建安装软件包,用户应该只能在特定位置安装它.

I am creating an installation package and user should be able to install it on a specific location only.

为此,我在[Code]部分中读取了一些注册表值,以确定安装路径.

In order to do so I read some registry values in the [Code] section to determine the installation path.

具有安装路径后,我需要强制Inno Setup在运行时将安装文件夹设置为特定位置.

Having the installation path I need to force Inno Setup to set the installation folder to a specific location at run-time.

在Inno Setup中有可能吗?如果需要,应该使用脚本的哪一部分?

Is this possible in Inno Setup? Which section of script should be used if so?

谢谢.

推荐答案

  • 使用脚本常量设置默认安装路径;
  • 使用 DisableDirPage指令以防止用户对其进行修改.
    • Use a scripted constant to set the default installation path;
    • Use the DisableDirPage directive to prevent an user from modifying it.
    • [Setup]
      DefaultDirName={code:GetDefaultDirName}
      DisableDirPage=Yes
      
      [Code]
      
      function GetDefaultDirName(Param: string): string;
      begin
        Result := ...;
      end;
      

      这篇关于如何强制Inno Setup动态设置安装文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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