IB53
16th December 2009 16:35 UTC
Registry Keys
I have looked through numerous example scripts and learned a lot, especially with help from this forum :up: . One thing I see regularly is setting registry keys. Here's an example:
WriteRegStr HKLM "Software\${APPNAME}" "" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$INSTDIR\uninstall.exe"
I've seen these particular keys more than once and I would like to know if Windows (or anything else) actually has a need for these to be set and if so do they apply to all versions of Windows? I'm guessing they are used by Control Panels/Add/Remove Programs but I'm not sure. If not, is there any practical advantage to setting them?
Thanks once more
Ian
redxii
16th December 2009 17:43 UTC
The first one isn't required, but you can use it determine if your program is already installed and where and prevent a second copy from being installed elsewhere, or with InstallDirRegKey when reinstalling/upgrading your program it'll automatically use the previous install directory stored in that location in the registry.
HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall" is for Add/Remove Programs. Setting them is not a requirement either but you should set them so your users can see it in Add/Remove Programs.
watzr
17th December 2009 10:24 UTC
As redxii said "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" adds entries to the "Add/Remove Programs" section in the Control Panel. In addition to that other information like installation path, will keep under a separate folder(sub key such as HKLM\Software\MYAPP) which is specific for the software we are installing. These information can be used to check whether software has been already installed, for patch installation details and upgrades etc.