Exporting Windows Registry settings by batch file

batchexportwindows-registry

I am writing a batch file to migrate certain settings from one windows machine to another. I'm having problems with the regedit /e switch.

In the script, I'm exporting ODBC system entries and Internet Explorer Trusted Sites. The ODBC command exports successfully, but the Trusted Sites command doesn't.

echo Exporting ODBC Information
start /wait regedit.exe /e "y:\%username%\odbc.reg" HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI

echo Exporting IE Trusted Sites
start /wait regedit.exe /e "y:\%username%\TrustSite.reg" HKEY_CURRENT_USER\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\INTERNET SETTINGS\ZONEMAP\DOMAINS

Do I need to tack on something after DOMAINS?

Thanks for the help! I'm either breaking new ground with this, or the problem is so simple that the solution appears nowhere on the Internet. Sigh

Best Answer

There's a space in the key path. Wrap it in double-quotes.