Question

How can I read and store the value of a Windows registry key in an installer variable?

How can I read and store the value of a Windows registry key in an installer variable?

Answer:

You can store the value of a registry key in an installer variable using a <registryGet> action. If the key or name does not exist, then the variable created will be empty. You will have to include a section like the one below inside an action list section of your XML installer project file.

<registryGet>
 <variable>installdir</variable>
 <key>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment</key>
 <name>MY_APPDIR</name>
</registryGet>