Backing up registry using batch

batch-file, registry, windows, windows-7

Solution

Exporting the whole registry to a single .reg file is not so easy, but you can use the `Reg.exe` utility that is installed with Windows to export a chosen root key.

Documentation for `Reg.exe` can be found here.

For example, to save each of the valid root keys (and all sub-keys) to their own files, you could do this:

ECHO OFF
reg export HKLM hklm.reg > nul
reg export HKCU hkcu.reg > nul
reg export HKCR hkcr.reg > nul
reg export HKU  hku.reg > nul
reg export HKCC hkcc.reg > nul

There is also a `save` option, that does a similar thing but stores the data in a different format.

Problem

I have windows 7 ultimate 32 bit and and I need a batch script that can backup the registry to a .reg file call "Registry backup" in the same directory as the batch file can any one help me find a code to do this.

Original source