【发布时间】:2021-06-20 19:34:48
【问题描述】:
我需要在两个不同的目标文件夹中安装安装程序(通过 inno setup 创建)。
我的目标是在安装时使用 ini 文件来确定目标目录。
Setup.ini 文件
[Settings]
#======================================================================
DestDir=C:\\Software\\Path1
#======================================================================
Inno 设置文件
#define DestinationDir ReadIni("Setup.ini", "Settings", "DestDir", "")
[Files]
Source: "D:\Publish\MyService.exe"; DestDir: "{#DestDir}"; Flags: ignoreversion
[Run]
Filename: "{#DestDir}\MyService.exe"; Parameters: "-i -name MyService-display ""My Service"""; StatusMsg: "Installing my service";
我将安装程序文件 (setup.exe) 与 .ini 文件(设置为 path1)一起复制到服务器并运行安装程序。我希望将 myService.exe 文件复制到 Path1(“C:\Software\Path1”)中。
然后我将.ini文件更改为以下并重新运行安装程序。我希望将 myService.exe 文件复制到 Path2(“C:\Software\Path2”)中。
[Settings]
#======================================================================
DestDir=C:\\Software\\Path2
#======================================================================
但是,这根本不起作用。似乎只有当我们通过 inno setup 创建安装程序时才能引用 ini 文件,而不是在执行安装程序时。有什么建议可以实现吗?
【问题讨论】:
-
路径名中不需要
\\。一个\就足够了。
标签: installation inno-setup ini