Alon
Alon

Reputation: 2929

Modification of Windows Registry via .REG file - copy and delete

I have this text in .reg file:

 Windows Registry Editor Version 5.00

 [HKEY_CURRENT_USER\Software\program]

 "item2"=item1
 "item3"=item1

In registry key [HKEY_CURRENT_USER\Software\program] there is a value item1. I want to put data of this value into another value item2 and item3 but the code that I tried does not work.

Furthermore how can I delete a registry value?

Upvotes: 0

Views: 1101

Answers (1)

cin
cin

Reputation: 351

I cannot find any reference of how to copy registry keys by means of .reg files. Anyway it can be done from command line (or batch script) by following command. (MS Technet)

REG COPY <SourceKeyName> <DestinationKeyName> [/s] [/f]

In your case it is:

REG COPY HKCU\Software\program\item1 HKCU\Software\program\item0

To delete keys/values (by means of .reg file) use this. (MS Support)

; for key
[-HKCU\Software\program\item10]

; for value
[HKCU\Software\program\item10]
"TestValue"=-

Upvotes: 1

Related Questions