How to create a desktop icon with Inno Setup

In [Files] section, you install your giotto.ico to the application folder (you may want to install the icon only when the desktopicon task is selected).

In [Icons] section, you create the desktop icon using the installed giotto.ico (when the desktopicon task is selected).

#define SourcePath "C:\Users\PycharmProjects\GIOTTOconverter\dist"
#define MyAppName "GIOTTO"
#define MyAppExeName "GIOTTO.exe"
#define MyAppIcoName "giotto.ico"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; \
    GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "{#SourcePath}\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#SourcePath}\{#MyAppIcoName}"; DestDir: "{app}"

[Icons]
Name: "{userdesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; \
    IconFilename: "{app}\{#MyAppIcoName}"; Tasks: desktopicon

If you want to create the icon by default, remove the Flags: unchecked. If you want to create the shortcut unconditionally, just remove the desktopicon [Tasks] section entry and Tasks parameter from the [Icons] section entry.


Though if the executable file (GIOTTO.exe) has the same icon linked into, you do not need to install the icon separately. Just use the icon from the EXE file:

#define SourcePath "C:\Users\PycharmProjects\GIOTTOconverter\dist"
#define MyAppName "GIOTTO"
#define MyAppExeName "GIOTTO.exe"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; \
    GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "{#SourcePath}\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion

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

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)