在Inno Setup的Run部分之后创建桌面链接图标 [英] Create desktop link Icon after the Run section of Inno Setup

查看:99
本文介绍了在Inno Setup的Run部分之后创建桌面链接图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

概述

我的安装过程涉及在磁盘上放置2GB以上的数据.所以我使用Inno Setup,但是我运行7ZIP来实际提取/安装文件.

My install process involves placing over 2GB of data on a disk. So I use Inno Setup, but I run 7ZIP to actually extract/install the files.

问题

我遇到的问题是,似乎在[Run]部分之前创建了桌面图标,因此没有用于设置桌面链接的图标.有没有解决的办法? (我已经尝试使用{src}{app}作为查找图标的文件夹.)

The issue I have is that it seems the desktop icon is being created before the [Run] section, so there is no icon to set the the desktop link. Is there a way around this? (I have tried both {src} and {app} as the folder to find the icon.)

代码

[Run]
Filename: "{pf64}\7-zip\7zG.exe"; Parameters: "x ""{src}\GL.7z"" -o""{app}\"" * -r -aoa"; \
  Flags: runascurrentuser

[Icons]
Name: "{group}\EGPL Watson Uninstall"; Filename: "{uninstallexe}"; WorkingDir: "{app}"
Name: "{commondesktop}\DashBoard"; \
  Filename: "{app}\dashboard\node_modules\electron\dist\electron.exe"; \
  WorkingDir: "{app}\dashboard"; IconFilename: "{src}\dashboard\build\configure.ico"; \
  Parameters: "main.js"; AfterInstall: SetElevationBit('{commondesktop}\DashBoard.lnk')

推荐答案

一种快速而肮脏的解决方案是设置 ChangesAssociations :

A quick and dirty solution is to set ChangesAssociations:

[Setup]
ChangesAssociations=yes

它使Windows资源管理器在安装程序完成后刷新所有图标.

It makes Windows Explorer refresh all icons after the installer finishes.

一种干净的解决方案是仅在[Run]部分之后使用 CreateShellLink :

A clean solution is to create the icon only after the [Run] section using CreateShellLink:

[Run]
Filename: "{pf64}\7-zip\7zG.exe"; \
    Parameters: "x ""{src}\GL.7z"" -o""{app}\"" * -r -aoa"; \
    Flags: runascurrentuser; AfterInstall: CreateIcon

[Code]

procedure CreateIcon;
var
  IconFileName: string;
begin
  IconFileName := ExpandConstant('{commondesktop}\DashBoard.lnk');

  CreateShellLink(
    IconFileName, '',
    ExpandConstant('{app}\dashboard\node_modules\electron\dist\electron.exe'),
    'main.js', ExpandConstant('{app}\dashboard'),
    ExpandContant('{app}\dashboard\build\configure.ico'), 0, SW_SHOWNORMAL);

  SetElevationBit(IconFileName);
end;

这篇关于在Inno Setup的Run部分之后创建桌面链接图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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