Registry Key extraction and migration

Larry Bates lbates at swamisoft.com
Tue Apr 6 18:23:50 EDT 2004


Ed,

Take a look at _winreg module.  It supports
everything you are looking for.  You were not
perfectly clear on what keys/values you needed
so the code below is a guess...

Larry Bates
Syscon, Inc.


import _winreg
regkey='software\old_lcoation' # Copied your spelling
value_name="XXX"
key=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, regkey)
value=_winreg.QueryValueEx(key, value_name)[0]

new_value="YYY"
key=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, regkey, 0,
_winreg.KEY_SET_VALUE)
_winreg.SetValueEx(key, value_name, 0, _winreg.REG_SZ, new_value)


"ed" <edwardt_tril at yahoo.com> wrote in message
news:7d7e723a.0404050927.12611c86 at posting.google.com...
> Hi I want to write a tool to do the following:
> 1. extract and display registry keys under abritrary starting point,
> for example:
> source are: HKey_Local_machine\software\old_lcoation or
> HKey_current_user\software\XXX\YYY
>
> a) then, I can specify where the Keys can be copied and compare the
> new location to the new location. For example: destination are:
> HKEY_local_mahcine\software\New_location.
>
> b) if the keys are not there flags error message
>
> how canI do that?





More information about the Python-list mailing list