Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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 –  Josefvz Mar 8 '12 at 11:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.