Unknown Hero wrote:
Hi everyone!
Well, I have this need for a Python script that will scan through a
selected hive (like HKEY_LOCAL_MACHINE) and replace all strings that
contain word xxx (IE. foo) with yyy (IE. moo). I do not want partial
results, but rather complete strings (no foome or the like, just foo).
I have a basic understanding of Python, but this is beyond my skills.
I was looking for something like this:
open key (HKEY_LOCAL_MACHINE)
while (not end of list)
open next subkey
search subkey for value (old)
SetValue(key, subkey, REG_SZ, new)
close subkey
end while
close key
In a spirit of teaching people to fish...
... If you put something like "Python windows registry" into Google, you
get quite a few hits, the top one of which is probably pointing to the stdlib
_winreg module, but several others point towards wrapper classes, modules
etc. which provide a simpler or at least a different interface to the registry.
Have a look at those and see if you can't work out what to do.
TJG
--
http://mail.python.org/mailman/listinfo/python-list