I need to pass a variable to loop over registry roots to gather all installed Python versions (different versions could be installed for all users or for current user) but the following simplified snippet won't compile:
Var PYTHON_VERSION
Var REGISTRY_ROOTS
Var REGISTRY_ROOT
Function getPythonVersions
StrCpy $REGISTRY_ROOTS "HKLM HKCU"
StrCpy $1 1
loop:
${WordFind} "$REGISTRY_ROOTS" " " "E+$1" $REGISTRY_ROOT
StrCmp $REGISTRY_ROOT "2" done
EnumRegKey $PYTHON_VERSION $REGISTRY_ROOT "Software\Python\PythonCore" 0
MessageBox MB_OK "$PYTHON_VERSION"
IntOp $1 $1 + 1
goto loop
done:
FunctionEnd
I get the following error:
Usage: EnumRegKey $(user_var: output) rootkey subkey index
root_key=(HKCR|HKLM|HKCU|HKU|HKCC|HKDD|HKPD|SHCTX)
Is there any way to loop over registry roots?
Sadly they have to be hardcoded, you can't use a variable.
You can:
There is already a ticket on the request tracker about this...