Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove a desktop shortcut by Innosetup

How can I remove a desktop shortcut by Innosetup? It's created by previous version and not needed anymore. I tried delete it in [InstallDelete]

[InstallDelete]
Type: files; Name: {userdesktop}\Shortcut Name

and delete the file in "ssInstall" of CurStepChanged event handler

DeleteFile(ExpandConstant('{userdesktop}\Shortcut Name'));

But they don't work. Any suggestion is appreciated!

like image 535
trudger Avatar asked Sep 06 '09 12:09

trudger


People also ask

How do I remove unwanted shortcuts from my desktop?

To remove shortcuts from your computer's desktop, just right-click on them and select "Delete" or "Move to Trash." You can also use the Delete key on your keyboard, or drag the shortcuts to the trash. Removing a shortcut from your desktop won't delete the app or folder that it's connected to.

How do I remove a shortcut from the home screen in Windows 10?

If you want to know how to remove shortcuts from the desktop in Windows 10 and Windows 11 using your cursor, you can right-click or press-and-hold on an icon to open a contextual menu. Then, click or tap on Delete if you're using Windows 10.

How do I change the icon on my Inno?

As you know the application icon is built into the .exe file. The Inno Setup cannot modify the .exe files. And there's no other way to override the application icon by an external one. You have to edit the .exe file yourself, before building the installer.


1 Answers

Either option will work, but there are a couple of considerations.

1) You'll either need to use {userdesktop} or {commondesktop} depending on whether the shortcut was installed for a specific user or for all users.

2) You'll need to make sure to add the .lnk extension to the shortcut name.

So this will probably work:

DeleteFile(ExpandConstant('{userdesktop}\Shortcut Name.lnk'));
DeleteFile(ExpandConstant('{commondesktop}\Shortcut Name.lnk'));

or

[InstallDelete]
Type: files; Name: "{userdesktop}\Shortcut Name.lnk"
Type: files; Name: "{commondesktop}\Shortcut Name.lnk"
like image 98
Gerald Avatar answered Oct 21 '22 08:10

Gerald