You've probably heard a thousand times that it's a good idea to back up your Registry before making changes to it. However, many people reach a point where they don't think that creating this backup is really necessary. If you're a seasoned Registry Editor veteran, you probably feel comfortable making changes to the Registry.
But what if the unthinkable ever did happen? Suppose you accidentally changed the wrong Registry key and disabled Windows 95? In a situation like this, your first instinct may be to panic. However, there's a way you can fix the problem without reinstalling Windows. In this article, we'll teach you how to deal with a catastrophic Registry failure.
The process of rebuilding your computer's Registry will go much smoother if you have at your disposal a second computer running Windows 95. If you don't have this luxury, you can still rebuild your Registry. Either way, you'll need a few tools to do so.
The first and most important tool is a Windows 95 Startup disk. The entire repair process depends on your being able to boot your PC to a command prompt. Although you may be able to press [F5] during the boot process and use the Command Prompt Only option to access the command prompt, Windows 95 may be damaged so badly in some cases that you can't use this option. In such an instance, a boot disk is your only way of accessing the command prompt.
The next tool you'll need is a copy of the MS-DOS version of PKZIP. You can download a copy from www.pkware.com. You'll need this tool whether you're using a second PC or not. If you're using a second PC, you'll be dumping the Registry's contents to a text file. A text file created from a basic Windows 95 Registry can be as small as about 900KB. However, in real life, you've probably installed other programs and configured various Windows 95 options on the damaged PC. Such installations drastically increase the size of the Registry. In our tests, regularly used PCs generated Registry text files that were typically 5-6MB in size. Since a standard floppy disk holds only 1.44MB, you'll have to use PKZIP to compress the text file to a size that will fit on a floppy disk.
If you don't have a second PC available or if you can't compress the file enough to make it fit on a floppy disk, you'll need a DOS-based text editor that can edit files of unlimited sizes. The editor that comes with MS-DOS won't do the job. We suggest using Ntuitive Editor. You can obtain a shareware copy by downloading the file Ntuit310.zip from www.shareware.com. After downloading the file, you'll have to use PKUNZIP to decompress it.
Once you've got all the necessary tools in place, you can create the Registry text file. To begin, use your startup disk to boot the damaged PC to the command prompt. Next, switch to your Windows 95 directory, type Regedit, and press [Enter]. When you do, you'll see the command-line switches for the Registry Editor, as shown in Figure A.
Figure A
The Registry Editor has command-line switches you can use to edit your Registry from DOS.
At this point, you'll need to use the various switches to dump the Registry's contents to a text file. To do this, you must enter the Regedit command followed by the switches and specifications for the System.dat, User.dat, and text files. For example, on our PC, Windows 95 is installed in C:\Windows. Therefore, the Registry files (System.dat and User.dat) are also located in the C:\Windows directory. As you can see in Figure B, we exported the Registry files by typing the command
Regedit /L:C:\Windows\System.dat /R:C:\Windows\User.dat /E Bad.reg
Although this command may seem complicated, we've simply used the REGEDIT command followed by the /L: switch and the location of System.dat; the /R: switch and the location of User.dat; and the /E switch and the name of the text file we're dumping the Registry to. When you've entered the appropriate command switches, press [Enter] to begin the dumping process. This process may take several minutes, depending on the size of your Registry.
Figure B
Use these switches to create a text file containing the Registry settings.
When the dumping process is complete, you should have a text file with the name you specified and in the directory you executed the command from. For example, in Figure B, we called our text file Bad.reg. Since we executed the command from the Windows directory, we now have a file called Bad.reg in our Windows directory.
After you verify the existence of the text file, you should make a backup copy of it. Since Windows 95 is still unoperational at this point, the simplest way to back up the file is from the DOS prompt. Simply copy the file to another file. For example, if you called the file Bad.reg, you might create a backup called Bad.bak by typing Copy Bad.reg Bad.bak and pressing [Enter].
Once you've backed up your text file, you're ready to edit it. If you plan on using another machine to edit the file, compress the file with PKZIP and then copy the compressed file to a disk. Next, take the disk to the other PC, decompress the file, and open it in WordPad.
If you plan on working with the file locally, use your text editor to open it. The Registry text file will look something like the one shown in Figure C. As you can see, the file lists all the Registry keys and subkeys in order.
Figure C
When you load the Registry text file into your editor, you'll see all the Registry keys.
At this point, locate the area of the Registry containing the problem entry by using your editor's Find feature. When you find the invalid entry, correct it. Be careful to leave the spacing intact and avoid changing anything you don't absolutely have to. If you know the correct value for the problem entry, you should replace the existing value with the correct one; otherwise, you may have to delete the entire subkey. When you've finished making the necessary changes, save the file. Make absolutely sure to save the file in text (ASCII) format, or you won't be able to use the file to update your Registry. After you've saved the file, go back to the DOS prompt.
Now that you've corrected the problem, you can overwrite your existing Registry with the Registry values contained in your text file. To do so, switch to your Windows directory and type Regedit followed by the appropriate switches. You should use the same switches you used to export the Registry, except for the last switch, which should be /C instead of /E. Figure D shows the command we typed to import our new Registry, Bad.reg, to the C:\Windows directory.
Figure D
Use the REGEDIT command to build a new Registry from your text file.
When you've finished, reboot your PC and try to launch Windows 95. Hopefully, Windows 95 will be error free. However, there may be circumstances in which using this technique returns only limited functionality. If that's the case, try using the Windows version of Regedit to make any additional changes to the Registry.
In this article, we've shown you how to recover from a catastrophic Registry error. Remember that you should use this technique only if Windows 95 won't boot.
______________________
This article is reproduced from the February 1998 issue of Windows 95 Professional. Windows 95 Professional is an independently produced publication of The Cobb Group. No part of this article may be used or reproduced in any fashion (except in brief quotations used in critical articles and reviews) without prior consent of The Cobb Group. To contact The Cobb Group, please call (800) 223-8720 or (502) 493-3200.
Copyright © 1998 The Cobb Group, a division of Ziff-Davis Inc. The Cobb Group and The Cobb Group logo are trademarks of Ziff-Davis Inc. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of Ziff-Davis is prohibited.