Windows Registry Manipulation

Murali Krishnan Ganapathy gmurali at cs.uchicago.edu
Tue Sep 17 11:52:15 EDT 2002


I have seen people in this news group asking about a higher level
access to the windows registry. I have written one. If people are
interested, I can post the code here. This uses _winreg, so does not
provide some things like Checking Access Permissions on Registry keys.
This is not object oriented. But it is easy to build an OO interface
on top of this.

Some sample code:

import winreg

# Add a new acronym to the database
winreg.SetAcronym('WIN',r'MICR\Windows\CurrentVersion')
# MICR automatically expands to HKLM\SOFTWARE\Microsoft
# and HKLM expands to HKEY_LOCAL_MACHINE

# change a value
winreg.SetValue(r'WIN\Explorer\Advanced\DontPrettyPath',1)

# This will prevent explorer from showing files like "ALLCAPS" as
"Allcaps"

- Murali



More information about the Python-list mailing list