How do you remove an advertised shortcut programmatically?

梦想与她 提交于 2019-12-02 17:40:32

问题


So I botched an msi installer and deployed it after only testing installation, not uninstall (bad I know, added running of an exe after install, but forgot to specify that it should only occur on install not uninstall).

I found the Windows Installer Cleanup util, and the related msizap that I'll use to automate the process. The problem now is that when a newer version is installed on top afterwards, the advertised shortcut still tries to do a repair (or whatever it's actually doing trying to load the old version) and fails. Running the program directly from the file works fine, but I need to remove the advertised shortcuts in an automated way. It doesn't need to be incredibly robust, fairly small private beta install-base right now, so can assume that shortcuts are in the originally installed locations of desktop and start menu.

Are there any special concerns I need to take into account for an advertised shortcut or can I just treat it as any other file and just remove it?


回答1:


AFAIK adverited shortcuts are responsible for doing the setup.
Those are special lnk files that have point to the installer with a spicel param that will preform the setup when they are activated (you can see the info with notepad or hex editor).
never the less, MSI zap should have remove all trace of the setup.
Does the setup runs if you do a zap then press the shortcut? or you get an error?




回答2:


As far as the shortcut is concerned, it's just a normal file that can be deleted.

However I'll caution you about using MSIZAP - it is really a last resort and leaves a lot of information behind, shared DLL counts, registry entries, files, etc. Once removing the Windows Installer information you then need to remove any information related to your program from the registry. SharedDLL ref counts are the worst thing as they'll screw up when you try to reinstall/uninstall with the new MSI.

Rob has a good post up detailing some of the pitfalls of using MSIZAP. It's not something you want to use unless you're prepared to manually hunt down all the registry information it leaves behind.



来源:https://stackoverflow.com/questions/748540/how-do-you-remove-an-advertised-shortcut-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!