How to access InstallDirRegKey in NSIS
Question
I can specify installation directory and registry value in NSIS like this:
InstallDir "$PROGRAMFILES\CTVI"
InstallDirRegKey HKLM "Software\CTVI" "Install_Dir"
Now I can access InstallDir
by using the notation $INSTDIR
throughout the script. How do I similarly access InstallDirRegKey
? Is there a similar notation as there exists for InstallDir
? I tried $INSTDIRREGKEY
but that is not. Now what I do is that I type HKLM "Software\CTVI" "Install_Dir"
everytime I require it. But that is not so DRY :)
Solution
When the InstallDirRegKey
attribute is used, NSIS will look-up the specified registry entry at startup and if it finds a path there it will place that value in $Instdir
before any of your code runs...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow