How to Replace All Occurrences of a String in Registry
Keywords: RegEntryType clone cloning
Question:
I would like to find out if I can use WinBatch registry functions to search the entire registry database and replace all occurrences of one string with another string. The registry is on a WindowsNT 3.51 server.Also, as a related project, I want to save the entire Netscape Navigator registry subtree to disk, then reload it as a new user logs it. This can be done manually via Save key and Restore in Regedt32. Is there a Winbatch method?
Answer:
In theory this could be done. The Reggie WIL Extender is designed to search the registry and return matching strings. You could then used those matching strings along with the suggestions below.If you look in the WIL help file for: RegEntryType (example below), there is an example of a "cloning" script that shows how to move thru the registry.
It does "touch" each data item in the relevant tree. With some modifications you could make it work. You could modify the code to save something to disk instead. You would need Keyname, dataitem, datatype, and value. Then loading it should be a matter of reading the file and writing to the registry.
Alternatively, you could figure out the format of a REG file and load that at startup instead.
P.S. Back up your registry first....
If you want to have different users use the same Netscape Settings, you can use the sample from RegEntryType (below) to copy the subkey into @REGMACHINE someplace, where it is retained and cloned back for any new users.
There is a Registry cloning/renaming script in the WinBatch UDF library.
Article ID: W13738Filename: Replace all Occurrences of a String.txt