I am very new of Inno Setup and I wish to add a Desktop icon to my executable in Inno Setup. The file is stored in
C:\\Users\\PycharmProjects\\GIOTTOconvert
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
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