The following regedit information is for command line usage. It is particularly useful for bootstrap setup for networked client administration.

To remove/delete a key with a REG file, set the key = "-" [HKEY_KEY_NAME\KeyName\SubKeyName1\SubKeyName2\etc...] "ValueName"=- REGEDIT [/L:system] [/R:user] filename1 REGEDIT [/L:system] [/R:user] /C filename2 REGEDIT [/L:system] [/R:user] /E filename3 [regpath1] OSR 2 and later versions REGEDIT [/L:system] [/R:user] /D regpath2 Windows Mode REGEDIT [/S] filename1 Switch Descriptions: /L:system - Specifies the location of the SYSTEM.DAT file. /R:user - Specifies the location of the USER.DAT file. filename1 - Specifies the file(s) to import into the registry. /C filename2 - Specifies the file to create the registry from. /E filename3 - Specifies the file to export the registry to. Regpath1 - Specifies the starting registry key to export from. (Defaults to exporting the entire registry). /D regpath2 - Deletes the specified registry key. /S - Silent merge (no confirmation dialogs) Defragging the Registry In OSR 2 (950B) Regedit can be used to sort and compact the registry. Export the entire registry from Regedit in Windows, go to MS-Dos mode and recreate the directory using the /c parameter. This will not work properly in Win 95 950 or 950A, only 950B. In Windows 98 see Scanreg to defrag the registry (though the above will work). Changes to the registry aren't actually deleted, just marked as unused. This makes the registry larger than it needs to be. To sort and compact the registry; Backup User.dat and System.dat (users may have a name for user.dat, eg, fred.dat). You will probably need to clear the attributes unless you have a good Dos Mode file manager. In Windows start Regedit and export [Registry Menu/Export Registry File, make sure Export Range is set to all] the entire registry to a reg file in the windows directory called Full.reg. Exit to Dos Mode and at the C:\windows> prompt type regedit /L:system.dat /R:user.dat /C Full.reg Values stored in the registry with CR/LF won't be restored properly. The only key this affects on my machine is Outlook Express signature strings which are at least two lines. Might be a good idea to run regclean before this. Delete full.reg and the backed up system.dat and user.dat if it all works. Create New Defragmented Registry REM Sample Batch File used to create new registry. REM Assumes that the exported file from Windows is called full.reg and REM is in the Windows directory. REM Assumes that User.dat is called that. Attrib /r /s /h c:\windows\system.dat Attrib /r /s /h c:\windows\user.dat Copy c:\windows\system.dat c:\windows\system.~da Copy c:\windows\user.dat c:\windows\user.~da regedit /L:c:\windows\system.dat /R:c:\windows\user.dat /C c:\windows\Full.reg Delete Backed Up Files REM Sample Batch File to delete the backup files. REM Use after Windows has successfully restarted Del c:\windows\user.~da Del c:\windows\system.~da Del c:\windows\full.reg Restore Old Registry REM Sample Batch File to restore previous Registry Attrib /r /s /h c:\windows\system.dat Attrib /r /s /h c:\windows\user.dat Copy c:\windows\system.~dat c:\windows\system.dat Copy c:\windows\user.~dat c:\windows\user.dat