Restoring Windows Application Settings
This article was published by ComputorEdge, issue #2207, , as a feature article, in both their print edition (on pages 20 and 22) and their website.
If you use Microsoft Windows, and you make any significant use of application programs, then you probably have changed the way that those applications look and function, at least to the extent allowed by the developers of those applications. The typical way that people make these changes is by using each application's Options dialog, normally accessed from the application's Tools menu. Most Windows applications then store these customizations in the Windows Registry, at least for all of the later versions of the operating system (XP, 2000, NT, 98, and 95).
After you have fully customized all of your Windows applications so that they behave as much as possible the way you would like them to, then you do not have to give any more thought to those settings, right? Well, not exactly. There are all sorts of reasons why you may want to save your applications' settings in some form other than being hidden away in the Registry of your current installation of Windows. For instance, you may purchase a notebook computer and want to use all of your desktop's applications, and not have to manually set all of your favorite customizations, all over again. Your notebook's Registry cannot be simply replaced by the Registry on your desktop machine.
The same situation applies if you need to reinstall Windows, by choice or otherwise. You might decide to install and use a much larger hard drive, perhaps to store all of those newly downloaded, er, music files. After you reinstall Windows, you will be starting out with a fresh Registry that does not contain any of your previous application settings. Or, your hard drive could fail (knock on silicon), and you have to start from scratch with a new disk. Or, your precious files could be assaulted by a virus, a Trojan horse, or a nasty-gram from the Recording Industry Association of America.
This is Progress?
The primary source of the problem is that there is no clear and easy way to isolate, save, and restore the customizations that you have made to a particular application. The "Add/Remove Programs" applet within Window's Settings > Control Panel has no such feature. Neither one of the Registry editors provided by Microsoft (Regedit.exe and Regedt32.exe) offers that capability. Few Windows applications allow you to conveniently export your settings in a separate file, so that they can be easily imported later after a reinstallation of the product.
One manually intensive approach is to record, in a document, in your own words, all of the settings that you make. This can be time-consuming, and also requires you to keep the document up-to-date if and when you alter those settings in the future. There are probably utilities available on the market for saving your settings. But that's just another blackbox — one more program to install and run, on the pile of growing utilities needed just to make full use of Windows and its supported applications.
It was actually much more convenient back in the days of DOS, when the average application saved all of its settings in a plaintext initialization file, which could be read and modified with any text editor. Typically, such a file had the extension ".INI", and was stored in the application's top-level directory; hence locating it was easy. Restoring your settings in a new installation of the application, was as simple as overwriting the brand-new initialization file with your older one.
But this allowed application vendors and end users more independence from Windows and thus Microsoft. It allowed users to conveniently copy their settings to installations on other operating systems, without having those settings locked away in the Registry vault. It was straightforward, independent of any proprietary datastore, and not tied to any particular operating system. Naturally, that would not do. Microsoft then introduced the "improvement" of having application vendors store their settings in a massive, binary, and intimidating Registry, which requires the use of Windows. If and when the Registry gets corrupted, the settings can be lost (all of them, not just one application's), and even Windows itself may be unusable.
As a programmer, I sought a way to use existing tools to isolate and save those settings, and not be dependent upon yet another Windows-specific utility program. This approach uses several steps, all of them programmed into a DOS batch file. There is not enough room in this article to include the source code for that batch file, but the process can be summarized. The essential steps, with the corresponding DOS commands, for a sample application called X, are:
- Create a "before" version of your Registry: regedit_win98.exe /e before.txt
- Halt temporarily to change the application settings: pause
- Create an "after" version of your Registry: regedit_win98.exe /e after.txt
- Find the differences: diff before.txt after.txt > X.reg
- Remove any irrelevant differences: edit X.reg
In steps 1 and 3, I use the Windows 98 Regedit program, here renamed to regedit_win98.exe, because it allows us to export ("/e") the Registry to a text file. This has been confirmed to work for Windows 2000, NT, and of course 98. Make sure that the program is within your command path (i.e., the PATH environment variable). Step 2 is needed to give you a chance to make all of your changes to the application's settings. In step 4, use any utility that can find and output the differences between two large text files. My favorite such program is part of a set of Unix utilities that have been ported to Windows. Any decent shareware website will have similar packages available.
In step 5, edit the differences file, X.reg, and remove every Registry entry that is not relevant to the specific application. When doing this, you will likely find that there are far more differences between the two files than you had expected. Most of them are unrelated and incomprehensible changes that Windows seems to make every time it is started. You will usually be able to discard the bulk of the entries, and end up with only those that apply to your application.
At the top of X.reg, be sure to include whatever is the first line of either before.txt or after.txt. For example, on a Windows 2000 machine, it would be "REGEDIT4". As long as X.reg has the extension ".REG", you will be able to apply those settings to your Registry by double-clicking on the file in Windows Explorer, which will then prompt you, "Are you sure you want to add the information in X.REG to the registry?".
Eventually, you will have a complete collection of settings files for all of your Windows applications that make changes to the Registry. Admittedly, this process involves some upfront effort in terms of creating a simple batch script to automate the process, and creating these individual Registry files. But if you have to reinstall applications as frequently as most Windows users do, you will save time in the long run, and dramatically increase the odds that you will not lose your valuable customizations.