Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created a batch file to backup my files. I also want to backup the registry. However when i run the regedit /e "U:\Backup\Registry\regbackup.reg" command it pops op the UAC UAC

Can i disable this; I Want the batch file to run silently.

Here is the batch file.

@echo off

echo ~~~ Backing up My Documents ~~~

Robocopy C:\Users\josef.vanzyl\Documents U:\Backup\Documents .. /E /SEC /MIR /R:2 /W:5

echo ~~~ Backing up the Registry ~~~

if not exist "U:\Backup\Registry" mkdir "U:\Backup\Registry"

if exist "U:\Backup\Registry\regbackup.reg" del "U:\Backup\Registry\regbackup.reg"

regedit /e "U:\Backup\Registry\regbackup.reg"

echo ~~~ Done! ~~~

share|improve this question
up vote 3 down vote accepted

Try using reg instead of regedit. regedit /e without specifying a key exports all of HLKM and HKCU (I think), so the equivalent would require two commands: reg export HKLM and reg export HKCU, which would result in two files.

@echo off

echo ~~~ Backing up My Documents ~~~

Robocopy C:\Users\josef.vanzyl\Documents U:\Backup\Documents .. /E /SEC /MIR /R:2 /W:5

echo ~~~ Backing up the Registry ~~~

if not exist "U:\Backup\Registry" mkdir "U:\Backup\Registry"

if exist "U:\Backup\Registry\regbackup_HKLM.reg" del "U:\Backup\Registry\regbackup_HKLM.reg"

echo Exporting HKLM

reg export HKLM "U:\Backup\Registry\regbackup_HKLM.reg"

if exist "U:\Backup\Registry\regbackup_HKCU.reg" del "U:\Backup\Registry\regbackup_HKCU.reg"

echo Exporting HKCU

reg export HKLM "U:\Backup\Registry\regbackup_HKCU.reg"

echo ~~~ Done! ~~~

There's probably some way to merge them into one file, but it's not really necessary. Also, reg can export the following root keys for me on Windows 7 (reg export /?):

  • HKLM HKEY_LOCAL_MACHINE
  • HKCU HKEY_CURRENT_USER
  • HKCR HKEY_CLASSES_ROOT
  • HKU HKEY_USERS
  • HKCC HK_CURRENT_CONFIG
share|improve this answer
    
Great! It worked! Thanks :D – Stingervz Mar 8 '12 at 11:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .