1.

Solve : Problem Writing Over Existing Files?

Answer»

I wrote a batch file that exports all of the registry hives,

HKEY_CLASSES_ROOT,
HKEY_CURRENT_USER,
HKEY_LOCAL_MACHINE,
HKEY_USERS, and
HKEY_CURRENT_CONFIG, to an external hard drive for backup.

The letter assigned to the external drive is G:

The batch file names the files:

001 HKEY_CLASSES_ROOT (HKCR).reg.txt
002 HKEY_CURRENT_USER (HKCU).reg.txt
003 HKEY_LOCAL_MACHINE (HKLM).reg.txt
004 HKEY_USERS (HKU).reg.txt
005 HKEY_CURRENT_CONFIG (HKCC).reg.txt

It WORKS beautifully the FIRST time I run it. But, if run it a second time, it gives me these messages.

For the backup file for 001 HKEY_CLASSES_ROOT (HKCR).reg.txt

The operation completed successfully

For the backup file for 002 HKEY_CURRENT_USER (HKCU).reg.txt

Error: Cannot create a file when that file already exists.

For the backup file for 003 HKEY_LOCAL_MACHINE (HKLM).reg.txt

The operation completed successfully

For the backup file for 004 HKEY_USERS (HKU).reg.txt

Error: Cannot create a file when that file already exists.

For the backup file for 005 HKEY_CURRENT_CONFIG (HKCC).reg.txt

The operation completed successfully

For some reason it doesn't have a problem overwriting the backup files for

001 HKEY_CLASSES_ROOT (HKCR).reg.txt,
003 HKEY_LOCAL_MACHINE (HKLM).reg.txt, or
005 HKEY_CURRENT_CONFIG (HKCC).reg.txt,

but it does have a problem with

002 HKEY_CURRENT_USER (HKCU).reg.txt and
005 HKEY_CURRENT_CONFIG (HKCC).reg.txt

I used the CACLS command on the two files I was having trouble with, to alter the permissions, and give them full control.

I typed the following commands into the command console:

First I changed the directory to the external hard drive with the command

CD "G:\Registry (Backup Files)"

Then i typed in

CACLS "002 HKEY_CURRENT_USER (HKCU).reg.txt" /e /c /g Owner:f

and

CACLS "004 HKEY_USERS (HKU).reg.txt" /e /c /g Owner:f

and it reported these two statments:

processed file: G:\Registry (Backup Files)\002 HKEY_CURRENT_USER (HKCU).reg.txt

and

processed file: G:\Registry (Backup Files)\004 HKEY_USERS (HKU).reg.txt

So, it processed both files and gave them full control, but it still will not let me overwrite them.

I used the program Unlocker to see if the files were in use, and locked by the system or not, and they were not. So, I am at a loss as to why I cannot overwrite these files.

They are not locked by the system, and they have full permission to be overwritten.

I don't want get around this problem by deleting, moving or copying them to another location.
I just want overwrite them.

Got any IDEAS about how to overwrite these files?

ThanksTry renaming all your current backups to "FILENAME.reg.txt.tmp" then check to make sure it wrote correctly, and if so delete "*.tmp".Exporting the hives may not give complete copies.

I used this under XP - or Cobian backup can do volume SHADOW copy.


ERUNT - The Emergency Recovery Utility NT
=========================================

Registry Backup and Restore for WINDOWS NT/2000/2003/XP

v1.1j, 10/20/2005, Freeware
Written by Lars Hederer



Discussion

No Comment Found