Good Tutorial for Python3 winreg Module

eryk sun eryksun at gmail.com
Sun Aug 21 01:39:13 EDT 2016


On Sun, Aug 21, 2016 at 3:55 AM,  <johncalvinhall at gmail.com> wrote:
>
> I need to pull a saved value from the registry, and the only way I
> know how to get it is through winreg.

Here's an example that reads the value and type of "Temp" in HKCU\Environment:

    import winreg

    with winreg.OpenKey(winreg.HKEY_CURRENT_USER, 'Environment') as key:
        value, dtype = winreg.QueryValueEx(key, 'Temp')

    >>> print(value)
    %USERPROFILE%\AppData\Local\Temp
    >>> dtype == winreg.REG_EXPAND_SZ
    True

I can help more if you provide a specific example of the value that
you need to read.



More information about the Python-list mailing list