PC Hardware

Editing the Registry

Editing the Registry directly can cause serious problems if it is not done correctly. Windows 95 provides the Control Panel and Properties sheets for editing the Registry. Microsoft recommends these methods. Microsoft does not support direct editing of the Registry.

If you feel you must edit the Registry, then back up first (see the end of this section for details on backing up the Registry). The tool used to edit the Registry is REGEDIT.EXE. (See Figure 16.6.) This program is not included in any of the menus and will not be found on the desktop. You must either activate REGEDIT.EXE through Windows Explorer or start the program from the command line.

Click to view at full size.

Figure 16.6 REGEDIT

The following table provides an overview of the commands in the REGEDIT.

Menu Commands
Registry Import Registry File: Allows you to take a Registry file that you've created or modified and import it into the current Registry. Importing a Registry file is often the best way to rescue a corrupted Registry or to replace the current damaged Registry with a known good backup.

Export Registry File: Allows you to export the Registry file to a floppy disk or network location. Exporting a Registry is one of the best ways to back up your Windows 95 system.

Connect Network Registry: Allows you to connect to a user on your network and, if you have the proper authority, modify that user's Registry. This is a very powerful feature, not necessarily one that a majority of users should have access to.

Disconnect Network Registry: Releases the connection to a network user's Registry.

Print: Allows you to print either the entire Registry, or just one of the keys or branches in the Registry.

Edit New: Allows you to create keys and assign values.

Delete: This command allows you to delete a key, key value, or value name.

Rename: This command lets you rename either a key or value name.

Find: Allows you to find a particular string or key value name.

Find Next: Finds the next value that was defined in the Find command.

View Status Bar: Either hides or shows the status bar at the bottom of the screen.

Split: This command lets you move the split bar (vertical separation) between the Key window (on the left) and the Value window (on the right).

Refresh: This command refreshes the REGEDIT screen.

The Edit command doesn't include the typical Copy, Cut, and Paste options. If you need to copy and paste in REGEDIT, you will need to use the Windows keyboard commands. Press CTRL+C for Copy, and CTRL+V for Paste. These two commands are a necessity if you do a lot of searching and replacing in the Registry.

REGEDIT's Dual Purpose

REGEDIT is more than a Windows utility program. It can be used from inside real-mode MS-DOS. This is particularly important if you have a seriously corrupted Registry file and Windows won't start. During installation, Windows 95 puts a copy of REGEDIT.EXE on the startup disk. When running REGEDIT in real mode, it doesn't have an interface-it uses a command-line format to carry out instructions. The following table lists the most common REGEDIT switches.

Switch Function
/? Displays the REGEDIT command-line syntax.
/L:system Provides the location and filename of SYSTEM.DAT.
/R:user Provides the location and filename of USER.DAT.
/E filename <regpath> Creates a Registry (.REG) file.
/C filename Replaces the entire Registry with the contents of your .REG.

To use REGEDIT in real mode, you'll need to tell it where your SYSTEM.DAT and USER.DAT files are located, if they are in a directory other than Windows.

Here is the syntax needed to replace an existing, corrupt Registry with the contents of the .REG file you created. Remember, this command is typed in full at the MS-DOS prompt:

 REGEDIT [/L:system] [/R:user] /C filename