Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i add the program in windows add/remove program list

Tags:

nsis

How do i add the program so that it is listed (so i can click on it to uninstall) in windows's add/remove program list?

like image 805
Jason94 Avatar asked Feb 17 '11 11:02

Jason94


People also ask

How do I manually add Programs to the Add Remove Programs list?

After you delete the key, click Start, point to Settings, and then click Control Panel. In Control Panel, double-click Add/Remove Programs. In Add/Remove Programs, verify that the program for which you deleted the registry key is not listed.

How do I get to add Remove Programs in Windows 10?

In the search box on the taskbar, type Control Panel and select it from the results. Select Programs > Programs and Features. Press and hold (or right-click) on the program you want to remove and select Uninstall or Uninstall/Change. Then follow the directions on the screen.

How do I add a program to my program list?

Using the Windows key + Left arrow keyboard shortcut snap the window with the application files to the left. Right-click, hold, drag and drop the .exe file that launch the apps to the Programs folder on the right.


2 Answers

The uninstall registration is stored in the registry, where in the registry you should save it depends on if your installer installs the program for all users or a single user (IE your RequestExecutionLevel setting):

  • user = HKCU
  • admin = HKLM
  • highest = SHCTX (This means you must use SetShellVarContext correctly and also restore it correctly in the uninstaller)

There are only two values that are required: DisplayName and UninstallString.

!define REGUNINSTKEY "MyApplication" ;Using a GUID here is not a bad idea
!define REGHKEY HKLM ;Assuming RequestExecutionLevel admin AKA all user/machine install
!define REGPATH_WINUNINST "Software\Microsoft\Windows\CurrentVersion\Uninstall"

Section
WriteRegStr ${REGHKEY} "${REGPATH_WINUNINST}\${REGUNINSTKEY}" "DisplayName" "My application"
WriteRegStr ${REGHKEY} "${REGPATH_WINUNINST}\${REGUNINSTKEY}" "UninstallString" '"$INSTDIR\uninstaller.exe"'
SectionEnd

There are several optional values you can set, MSDN does not really provide a list of documented values but the NSIS Wiki has a decent list and this page has a even more complete list...

like image 82
Anders Avatar answered Oct 28 '22 18:10

Anders


Example usage:

 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \
   "DisplayName" "<Name>" ;The Name shown in the dialog
 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \
   "UninstallString" "$INSTDIR\<Path to uninstaller>"
 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \
   "InstallLocation" "$INSTDIR"
 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \
   "Publisher" "<Your Name>"
 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \
   "HelpLink" "<URL>"
 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \
   "DisplayVersion" "<Version>"
 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \
   "NoModify" 1 ; The installers does not offer a possibility to modify the installation
 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \
   "NoRepair" 1 ; The installers does not offer a possibility to repair the installation
 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \
   "ParentDisplayName" "<Parent>" ;
 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<Name>" \
   "ParentKeyName" "<ParentKey>" ; The last two reg keys allow the mod to be shown as an update to another software. Leave them out if you don't like this behaviour
like image 31
Creshal Avatar answered Oct 28 '22 17:10

Creshal