[python-win32] export registry keys

Tim Roberts timr at probo.com
Fri Mar 10 18:52:14 CET 2006


On Fri, 10 Mar 2006 09:29:07 +0100, le dahut <le.dahut at laposte.net> wrote:

>I was thinking about win32api.RegSaveKey or _winreg.SaveKey but on XP it 
>must be preceded by a privilege modification and they don't save regular 
>.reg files but internal reg format ...
>My app will be py2exeded and used by hundreds of people so I can install 
>Resource Kits or other stuff, it must be done with python and/or 
>internal windows commands.
>  
>

If you're going to do it from Python, then you don't have to worry about
using the standard regedit format.  There are a couple of registry class
wrappers for Python that turn a registry key into a Python object tree. 
You could fetch the key and pprint it to a file, then eval it later to
restore it.

>Someone has an idea ? (otherwise I'll use "reg export" under XP and 
>regedit /E with 98 but it seems very barbarian isn't it  ;-)  )
>

Why is it barbarian?  It's called "using the tools at your disposal".

By the way, "regedit /E" works perfectly well on XP, so you could use
the same scheme everywhere.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-win32 mailing list