2

I am trying to add keys to the Windows Registry without replacements. I have tried this method to import the registry:

Regedit.exe /s "C:\reg\file.reg"

But this overwrites the currently existing keys.

I have also tried ‘Reg Add’ command; this also overwrites the existing value.

How to import a .reg file contents without overwriting the existing keys and values using command?

Also how to append the data to registry values? For example I have

Value=dword:00000001

Now I want to add 00000002 to the same value i.e.

Value=dword:00000001, 00000002

How to achieve this using Windows command?

4
  • Check if the key exists first?
    – DavidPostill
    Commented Mar 16, 2016 at 13:43
  • 1
    Workaround: Use "reg.exe add" without the /f parameter. When you're asked to overwrite or not,click No. But this is not an option if you're applying settings for multiple computers in a domain. 2nd question: Pls provide more information. Only the data for MULTI_SZ types can be appended.. not for REG_DWORD
    – w32sh
    Commented Mar 16, 2016 at 14:10
  • If you want to append data, why don't you not append the data in the .reg file, that way you overwrite the data with what you actually want. So in other words export the current information then change it.
    – Ramhound
    Commented Mar 16, 2016 at 15:08
  • Actually I will be not knowing what data is there initially. Yes I can export and change but if I want to change some 1000 values or If I want to change in 100 computers then exporting and editing reg file is difficult to manage. Commented Mar 17, 2016 at 4:32

2 Answers 2

2

The answer is quite simple, for anyone else who comes across this post.

I have had to do this a few times thanks to Windows 10 and it's ability to mess up regularly over nothing.

When this happens, I export everything from the local machine \ software key (or whatever reg keys you need) from the old machine.

Next is the important part - you extract the existing registry from the new machine. You then load up regedit and import the old registry files. (DO NOT CLOSE DOWN REGEDIT!) Then simply re-import the new ones you just created.

This has worked for me on numerous occasions saving literally months of re-installing at a time (and especially as half of my apps will not install under Windows 10 but worked in Windows 7 and have been upgraded to Windows 10 and work).

You can also, for example if you're having to deal with a new install, just copy across all the old application and folders (do not overwrite existing files) and all your apps and their needed files will work.

1

I don't think we can add such value in registry key.

Add 2 values like this:

enter image description here

Or just define one value name with 2 value data, one means enable, two means disable.

See structure of registry key: https://msdn.microsoft.com/en-us/library/windows/desktop/ms725490(v=vs.85).aspx

You must log in to answer this question.

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