Reputation: 6707
[ICONS]
Name: {commondesktop}\{#oemtitle}; Filename: {app}\app.exe; WorkingDir: {app}; IconIndex: 0; Flags: createonlyiffileexists
How to make the above icon only if running elevated, currently my setupper displays an error dialog for this icon when setupper is executed with the lower permissions as I have PrivilegesRequiredOverridesAllowed=dialog that allows end-user to choose to install to themself only.
Upvotes: 1
Views: 250
Reputation: 202088
Use {autodesktop}
constant to create the icon on common desktop when elevated and on user's desktop otherwise.
[Icons]
Name: {autodesktop}\{#oemtitle}; Filename: {app}\app.exe; ...
To answer your literal question: To create an icon when running elevated only, use Check
parameter with IsAdminInstallMode
function (or IsAdmin
).
[Icons]
Name: {commondesktop}\{#oemtitle}; Filename: {app}\app.exe; \
WorkingDir: {app}; IconIndex: 0; Flags: createonlyiffileexists; \
Check: IsAdminInstallMode
Upvotes: 2