I created an window application for which I need to create setup.For creating setup i am using NSIS. I had written script to create setup file I need to link this setup file to Add/remove program. For add link to add/remove program I am using following code:

 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\appName" "DisplayName" "Name"
 WriteRegExpandStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\appName" "AppName" '"$INSTDIR\UninstallApp.exe"'

To delete the link from add/Remove program I am using following code :

 DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\appName"

But this is not working.

有帮助吗?

解决方案

Except for the fact that "AppName" is wrong and should be "UninstallString" it looks like the code should work.

You should inspect it with Process Monitor and see why the delete fails. My only guess at this point is that your real code has a typo...

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top