---------------------------------------------------------------
Regedit Command Line Switches
The following list is of (some) of the command line switched that
are available for Regedit.exe.
Regedit /s File_Name.reg
Merges the file specified in File_Name to the registry,
and suppreses the standard "Are you sure?" and
"File merged" dialogue boxes. Handy for Merging during
batch processes.
Regedit /e File_Name.reg Key
Exports the registry key specified in Key and all sub
keys and values to the file specified in File_Name.reg.
The Key must exist, and must be fully typed out. For
example you must type out HKEY_LOCAL_MACHINE, you cannot
use the abbreviation HKLM.
---------------------------------------------------------------
---------------------------------------------------------------
Some More Regedit Command Line Stuff
MSDos Mode
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
/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
---------------------------------------------------------------