如何获取脚本部分的当前安装目录?

How to get current setup directory for the script section?

[Run] 部分下,我想将工作目录更改为执行安装程序的目录。例如,如果设置是从桌面执行的,我希望工作目录指向桌面:

Filename: "{app}\setup.exe"; WorkingDir: "{app}"; MinVersion: 0.0,6.0; Flags: skipifsilent

使用{src}常量。文档将其描述为:

{src}

The directory in which the Setup files are located. For example: If you used {src}\MYPROG.EXE on an entry and the user is installing from "S:\", Setup will translate it to "S:\MYPROG.EXE".

在您的情况下,您可以像这样使用它:

[Run]
Filename: "{app}\setup.exe"; WorkingDir: "{src}"; MinVersion: 0.0,6.0; Flags: skipifsilent