The Registry

Accessing the registry is easy.

First setting a value: from Microsoft.Win32 import Registry

registryRootNode = "HKEY_CURRENT_USER\\Software\\IronPythonTest\\IronPythonTest" testKey = "TestKey" value = "A test value..."

Registry.SetValue(registryRootNode, testKey, value)

Then getting a value: defaultValue = '' print Registry.GetValue(registryRootNode, testKey, defaultValue)

Enumerating a node: from Microsoft.Win32 import Registry products = Registry.ClassesRoot.OpenSubKey('Installer\\Products') for product_name in products.GetSubKeyNames: product_key = products.OpenSubKey(product_name) print product_key.GetValue('ProductName')

See the MSDN docs for more details: Registry Class.

Back to Contents.