Search code examples
nsis

How to get the subkey from the key in the registry tree using NSIS?


From the below registry tree structure, how to get and show the the subkey (3.1.0) from the below path:

SOFTWARE\WOW6432Node\APE\PowerChart\

HKLM
    SOFTWARE
        APE
            PowerChart
                3.1.0

enter image description here


Solution

  • Assuming you are using normal 32-bit NSIS you can just enumerate the subkeys if you don't know which exact version you are looking for:

    Section
    StrCpy $0 0
    loop:
      EnumRegKey $1 HKLM "SOFTWARE\APE\PowerChart" $0
      StrCmp $1 "" done
      IntOp $0 $0 + 1
      MessageBox mb_ok "Key: $1"
      Goto loop
    done:
    SectionEnd