I'm creating a shortcut on users Desktop with Inno Setup:
Name: "{commondesktop}\Setup"; Filename: "{app}\Setup.exe"; WorkingDir: "{pf}\Program"; IconFilename: "{app}\Setup.ico"
But users, with no admin rights, cannot delete this Shortcut, how to grant permissions to regular users, to delete this icon? Icon should be created on every user's desktop, but user should have permission to delete it.
The
{commondesktop}
shortcut is shared on a common desktop. So there's only one copy of the shortcut.If you allow the users to delete, when one user deletes the icon, it's deleted for every other user. That's why regular users are not allowed to modify/delete shared shortcuts.
While you can grant a delete permission to all users to that shortcut, this is not what you should do.
If each machine is used by one user only, install the icon to
userdesktop
, notcommondestop
. But that works only if that user (not Administrator) actually run the installer. For a general discussion about this problem, see Installing application for currently logged in user from Inno Setup installer running as Administrator.There's no easy way to install the icons to all desktops. You have to use Pascal Scripting and iterate all profiles.
Easy way is to iterate subfolders of
C:\Users
, creating a shortcut inDesktop
subfolder of each user's subfolder:The code will work only, if the desktops are local and in common locations.
If you need a more robust solution, you can iterate profiles listed in
Or use a WMI query like: