从提升的 Inno Setup 安装程序在用户开始菜单中创建快捷方式

Creating shortcut in user Start menu from elevated Inno Setup installer

在其生命周期中,MyApp 会创建指向 Userappdata 的额外快捷方式,

MyAppGroupName\MyAppShortcut#2
MyAppGroupName\MyAppShortcut#3
...

然而,由于 Inno Setup 需要提升,因为注册表关联编辑原始 {Group} 项目被插入到不同的 (commonstartmenu) 目录中:

MyAppGroupName\MyAppShortcutAtInstallation

对安装中的 {Group} 风格非常满意,所以

DisableProgramGroupPage=yes

现阶段不可行。否则在 Dirs 中创建路径,如

{Userappdata}\MyAppGroupName

在当前脚本中似乎不起作用:

        ...
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
ChangesAssociations = yes


[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
; (Note: Scroll to the right to see the full lines!)
Source: "Test.exe"; DestDir: "{app}"; Flags: ignoreversion

[Icons]
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"

[Registry]
Root: HKCU; Subkey: "Software\Auth/MyApp"; Flags: uninsdeletekey
Root: HKCU; Subkey: "Software\Auth\MyApp"; ValueType: string; ValueName: "Name"; ValueData: "{app}";

;Association
Root: HKCR; Subkey: ".XXX";ValueData: "{#MyAppName}";Flags: uninsdeletevalue; ValueType: string; ValueName: ""
Root: HKCR; Subkey: "{#MyAppName}";ValueData: "Program {#MyAppName}";   Flags: uninsdeletekey; ValueType: string; ValueName: ""
Root: HKCR; Subkey: "{#MyAppName}\DefaultIcon";ValueData: "{app}\{#MyAppExeName},0";ValueType: string; ValueName: ""
Root: HKCR; Subkey: "{#MyAppName}\shell\open\command";ValueData: """{app}\{#MyAppExeName}"" ""%1""";ValueType: string;ValueName: ""


[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: en;  MessagesFile: "compiler:Default.isl"
Name: deu; MessagesFile: "compiler:Languages\German.isl"
Name: es;  MessagesFile: "compiler:Languages\Spanish.isl"

[Dirs]
Name: "{userstartmenu}\{userstartmenu}\{#MyAppName}"

[UninstallDelete]
Type: files; Name: "{#MyAppName}.chw"

是否有任何已知的方法可以在提升的场景中将 {Group} 指向 {Userappdata}?或任何其他帮手,例如here?

如果我正确理解你的问题,你正在寻找 {userprograms} and {groupname}:

的组合
[Icons]
Name: "{userprograms}\{groupname}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"

不过请注意:

  • 您的方法总体上是有缺陷的。安装程序不应同时要求提升和修改特定用户的环境。提升可以更改用户上下文(例如,如果管理员帐户与普通用户帐户不同)。所以你不知道,如果 "user" 是正确的用户。
  • 在“开始”菜单中使用组违反 Windows Windows 8 及更高版本的准则。