0

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! ~~~

3

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
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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