Windows XP: Deploying Registry Changes With a Text File

EddieC 1 Tallied Votes 461 Views Share

If your application provides custom dialog-box features, menu items or other capabilities by making changes to the Windows Registry, you can deploy those capabilities to other computers simply by distributing an update or patch to the Registry.

Updating the Registry involves nothing more than exporting the capabilities from the Windows Registry Editor to a file and applying them on the target system(s). Carrying those changes is a plain text file with an .reg extension, and contains the key(s) or value(s) you've created. It's applied either by double-clicking its icon in Windows Explorer, importing via RegEdit or executing it from a command line.

Here's how to create the file:

1. In RegEdit, navigate to the branch or sub-branch that contains your functionality. It doesn't matter how deeply buried the key(s) are that contain your features; just that you select only your own changes. It might be necessary to analyze the registry before and after you make your changes to figure out which Registry keys are storing your functionality. If you're confident you can do that, skip to step 2.

How to Identify Your Registry Changes
1a. Reboot Windows, running as few apps and system tray utilities as possible.
1b. Open RegEdit and single-click the HKEY_CURRENT_USER branch. Select File>Export to export the branch. Repeat for the HKEY_LOCAL_MACHINE branch.
1c. Implement the changes necessary for your application.
1d. Repeat step 1b--be careful not to change anything else in Windows.
1e. Use your favorite diffing utility to identify differences between the two files before and after the changes. Save ONLY THE DIFFERENCES of each file pair as two separate text files.
1f. Examine those text files for changes pertaining to your work. Text that appears in [SQUARE BRACKETS] is the Registry key name, followed by the changes made to that key. Delete any unrelated text and formatting added by the diff utility.
1g. At the top of the file, add the text "Windows Registry Editor Version 5.0" plus a blank line.
1h. Save the file with a .reg extension.
1i. Repeat steps 1f through 1h for changes in HKEY_LOCAL_MACHINE, if necessary.
NOTE: If implementing changes to multiple branches in a single file, do not repeat the "Windows Registry Editor Version 5.0" header.

Once you've identified your Registry changes:
2. Single-click the branch containing your functionality and select File>Export.

3. Save the branch containing your work with a .reg extension.

4. To apply the changes...

...from the command line, execute the command

regedit /s file.reg

where "file.reg" is the name and full path of your file. The "/s" switch suppresses confirmation.

...from within Windows, double-click the .reg file and follow the prompts.

...from within RegEdit, select File>Import, select the .reg file and follow the prompts.