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

时间:2017-06-13 15:33:40

标签: inno-setup usergroups privilege

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

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

然而,由于注册表关联编辑,Inno安装程序需要提升,原始{Group}项目将插入另一个( commonstartmenu )目录中:

MyAppGroupName\MyAppShortcutAtInstallation

非常满意安装中的{}风格

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"

在提升的方案中,是否有任何已知的方法将{}指向{ Userappdata }?或任何其他助手,例如here

1 个答案:

答案 0 :(得分:1)

如果我正确理解您的问题,您正在寻找{userprograms}{groupname}的组合:

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

虽然注意到:

  • 你的方法总的来说是有缺陷的。安装程序不应同时要求提升和修改特定用户的环境。提升可以更改用户上下文(例如,如果管理员帐户与常规用户帐户不同)。所以你不知道,如果"用户"是合适的用户。
  • 在“开始”菜单中使用组符合Windows 8及更高版本的Windows指南。