By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,533 Members | 1,334 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,533 IT Pros & Developers. It's quick & easy.

Registry Key extraction and migration

P: n/a
ed
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?
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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" <ed**********@yahoo.com> wrote in message
news:7d**************************@posting.google.c om...
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?

Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.