Troubleshoot and repair your registry
Every time you boot up your PC, you wait while it runs through its series of hardware self-checks and then initialises the software. Much of this process is visible on the screen. But deep in the background, your hardware and software consult the Windows Registry, the central repository of your PCs system settings and configurations. No on-screen messages alert you to that activity. The process reveals itself only when serious problems arise, as when a device isn't recognised or Windows won't start. When you have device headaches, you can install a new driver or run the Add New Hardware applet in Control Panel. But if your system refuses to load the operating system, all you know is that Windows can't access the Registry or has insufficient memory to load it. The message may include an option to restore the Registry from Windows' automatic backup (user.da0 and system.da0 in the Windows folder in Win 95, or certain .cab files in the Windows\Sysbckup folder in Win 98); but if those files are corrupted as well, you're in deep trouble. If this evil fate befalls you, here are some tips and repair plans for rescuing (or at least salvaging) the Registry using the good old DOS prompt. Even if you don't have a Registry problem right now, save this article ù one day you'll thank me! If you're using Windows 98, chances are Windows either will send you to the DOS prompt when you boot, or will display the boot menu so you can arrange to go there yourself. In Windows 95, you'll need to restart your system. When you see the 'Starting Windows 95' message, press <F8> to display the Windows 95 Startup Menu; then press 7 and <Enter> to choose Safe Mode Command Prompt. At this point, I recommend backing up your Registry files (corrupted or not) to ensure that your tinkering doesn't make matters any worse: go to your Windows directory (for example, type cd \windows and press <Enter> if that's the folder where Windows is installed). Since the Registry files are hidden, type attrib -s -h -r *.da* and press <Enter>. Then use the Copy command to copy the following Registry files to another folder: system.dat, system.da0, user.dat, and user.da0. (Windows 98 users won't see the files ending in da0.) Be careful not to overwrite any previous backups in the process. For example, if you want your backups stored in the c:\temp folder (and you don't have any other Registry backups there), type copy system.da* c:\temp and press <Enter>; then type copy user.da* c:\temp and press <Enter>. You can always restore these files to the Windows folder if something goes awry. Do this no matter which of the following techniques you subsequently adopt. Plan 1 (Win 98). Now you're ready to start your repair work. If you're using Windows 98, you have a tool at your disposal to simplify the chore. At the DOS prompt, type scanreg and press <Enter>. (Windows may already have told you to do this when you rebooted and found yourself at the boot menu.) ScanReg starts with a screen noting its function and containing two DOS-like buttons, Start and Cancel. Start is highlighted by default; press <Enter> to start the process. ScanReg restores the Registry from the last good backup ù that is, the last copy of the Registry that Windows successfully started up with ù and lets you restart your computer. When prompted, press <Enter> to restart your computer. Caption: A corrupted Registry isn't the end of the world if you have a Registry backup Plan 2 (Win 98). If that doesn't do the trick, or if you're concerned that your latest backup may also be corrupted, return to the DOS prompt and type scanreg /restore. This causes ScanReg to display a list of backup files, together with the date of each. Select the copy you prefer, and then, with Restore highlighted, press <Enter> to restore it. Plan 3 (Win 98). On the other hand, if you just installed some software and suspect its settings might not be in the backup ù or if you have no backup files ù start ScanReg by typing scanreg /fix at the DOS prompt and pressing <Enter>. If you're lucky, ScanReg will be able to repair the Registry. If not, keep reading. Plan 4 (Win 9x). If you're using Windows 95 ù or if ScanReg doesn't do the trick in Windows 98 ù it's time to get out that floppy and try restoring the Registry from a backup you made before the problems began. When you get to the DOS prompt, rename the system.dat (Win 95 and 98) and system.da0 (Win 95 only) files by entering the command ren system.dat system.dat.bak followed by ren system.da0 system.da0.bak. Then copy these files to the Windows folder. If your backup files are in c:\backup, for example, type copy c:\backup\system.dat c:\windows (your actual path may differ) and press <Enter>. Restart your computer. If that doesn't work, do the same for the user backup files, user.dat and user.da0. Windows settings that have been changed ù or programs that have been installed ù after you made the backup may not work properly, and you may have to reinstall them. Plan 5 (Win 9x). Still in trouble? The DOS version of the Registry Editor, regedit.exe, may be able to save your bacon, whether you're operating under Windows 95 or Windows 98. You can solve some Registry problems by exporting the Registry to a text file and then importing it back again. To export the user.dat portion to text, type a line similar to the following at the DOS prompt: regedit /l:c:\windows\user.dat /e c:\user.txt (your paths and export file name may differ). Press <Enter>. The /e switch indicates export, and the /l switch specifies the particular portion of the Registry that you're working with (more on this point later). Now rename the existing user.dat file by typing ren user.dat user.bak and pressing <Enter>. Finally, to re-create the user.dat file based on the text file you exported, type regedit /l:c:\windows\user.dat /c c:\user.txt (your paths and export file name may differ) and press <Enter>. As I'll explain later, Windows 98 users (but no one else) should substitute /r for /l in this command line. In either version of Windows, you'll need to include the /c switch to re-create the Registry from the text file. Now restart Windows and hope that everything is cool. If the error persists, try the same thing with the system.dat portion of the Registry. Reboot to the Safe Mode Command Prompt, as before. At the DOS prompt, type regedit /l:c:\windows\system.dat /e c:\system.txt (your paths and export file name may differ) and press <Enter>. Now rename the existing system.dat by typing ren system.dat system.bak and pressing <Enter>. Finally, to re-create the system.dat file based on the text file you exported, type regedit /l:c:\windows\system.dat /c c:\system.txt (again, your paths and export file name may differ) and press <Enter>. Plan 6 (Win 9x). Extremely experienced users ù and knowledgeable users who are sure about what's wrong with the Registry ù may be able to edit the Registry itself from the DOS prompt. For example, if your system problems arose immediately after you made some Registry change in Windows, you can export the entire Registry to a single file (not just one part at a time, as described above) by typing regedit /e registry.txt (any file name will do) and pressing <Enter>. Then you can use Edit.com to open the text file you created (type edit registry.txt and press <Enter>) and make the necessary changes. When you have finished editing this text file, save the file and exit Edit.com. If you don't need to re-create your Registry files but merely want to merge the changed information, you can skip the /c switch and simply type regedit registry.txt and press <Enter>. Then restart the computer and cross your fingers. If this technique creates a text file that's too big for Edit.com, try the previously discussed techniques to establish a separate text file for each portion (user and system) of the Registry; edit the text file(s) and import each as described above. These tricks are anything but foolproof. Large Registry entries can stymie the DOS version of the Registry Editor that comes with Windows 95. If that happens, you'll see an error message like 'Unable to open registry (14)' when you try to import or export your Registry file. Another complication: if you type regedit /? at the DOS prompt, the help listing will tell you to use the /l switch for system.dat and the /r switch for user.dat in all cases. In my experience, however, you must use the /l switch (with the /e switch ù as discussed in Plan 5) when exporting any Registry file if you want to produce a properly exported file. Using the /l switch (together with /c) is also the best choice for re-creating the user.dat file in Windows 95. In Windows 98, on the other hand, you must use the /r switch (with the /c switch) to re-create the user.dat portion of the Registry. But doing this has its own difficulties: whether you use Windows 95 or 98, re-creating the user.dat with a command line like regedit /r:c:\windows\user.dat /c c:\user.txt restores user.dat but ù catch-22 ù corrupts system.dat! Consequently, if you find that you have to restore the Registry this way in Windows 98, you should first export user.dat and system.dat; then restore user.dat; and finally restore system.dat to correct any corruption that occurs during the rehabilitation process. Plan 7 (Win 9x). If these or other problems foil your efforts to use regedit, you still have recourse to other, less desirable options. One technique is to restore system.dat by using system.1st, a backup that Windows creates during installation. At the DOS prompt, go to the root directory (type cd\ and press <Enter>). Type attrib -s -h -r system.1st and press <Enter>. Then copy this file back to the Windows directory as system.dat, by typing copy system.1st c:\windows\system.dat (remember, your path may differ). Next, restart Windows. In this case, as with other backups, you may have to reinstall software and redo changes that were made after this backup was created. - Scott Dunn |
Category:win95, win98 Issue: July 1999 |
These Web pages are produced by Australian PC World © 1999 IDG Communications