Get particular registry key value ( example get architecture bit )

You can use below script to get any registry key value,

Note: This script will provide you architecture value of system


import _winreg;
key = getattr(_winreg,"HKEY_LOCAL_MACHINE")
handle = _winreg.OpenKey(key, "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" )
(value, type) = _winreg.QueryValueEx(handle,"PROCESSOR_ARCHITECTURE")
print (value)

sample output would be,