Regedit support a /e command line switch.

To export and .Reg file from the command line or batch script, use the following syntax:

regedit /e <Drive:>\Folder\FileName.reg KeyName

Example: To export HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer, use:

regedit /e c:\zzz\reg.reg "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer"

NOTE: Quote marks are required due to spaces in the key name.