Skip to main content

A Modern Python wrapper for the Windows registry

Project description

“Use the Windows Registry like a king”
A Modern Python wrapper for the Windows Registry (wrapping winreg)
Python Windows Registry Module
Access Registry like a dict


pip install winregal


Use winregal.RegKey along with the ‘with’ statement to access any key of your choice. winregal handles key opening and closing for you and makes iteration really simple.

Get a Key hierarchy with all values as a dictionary

Example : Print Putty sessions

In[2]: from winregal import RegKey
In[3]: with RegKey("HKEY_CURRENT_USER\SOFTWARE\SimonTatham\PuTTY\Sessions") as key:
...     print(key.to_dict())
{'Server1: {'UserName': u'user', 'HostName': u'', ... },
 'Server2': {'UserName': u'user', 'HostName': u'', ... }}

Iterate over Key hierarchy handling only values

Example : Print most recently run commands(RunMru)

In[1]: with RegKey("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU") as key:
...     for item in key:
...         if isinstance(item, RegValue):
...             print(,
('a', u'cmd\\1')
('b', u'winword\\1')
('c', u'notepad\\1')
('d', u'control\\1')
('e', u'regedit\\1')
('f', u'calc\\1')
('j', u'notepad++\\1')

Directly access a value / key

In[10]: with RegKey(“HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerRunMRU”) as key: … print(key[‘a’].data) … cmd1

Next in module Development

  • Support ConnectRegistry (via RegKey.__init__)
  • Wrap Edit/Save/Delete operations: e.g. CreateKey, DeleteKey, DeleteValue, SetValue, SaveKey

Contact me ( if you need these anytime soon.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for winregal, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size winregal-1.0.1-py2.py3-none-any.whl (7.5 kB) File type Wheel Python version 2.7 Upload date Hashes View
Filename, size winregal-1.0.1.tar.gz (5.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page