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!
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"