How to add the same value to multiple registry keys

0

I have a single value that I'd like to add to many different keys using a .REG file, and I just want to make sure that the syntax I currently have is correct before I risk running it on my machine.

[HKEY_CLASSES_ROOT\WMP11.AssocFile.MP4\shell\Enqueue\command]
[HKEY_CLASSES_ROOT\WMP11.AssocFile.m3u\shell\Enqueue\command]
[HKEY_CLASSES_ROOT\WMP11.AssocFile.MPEG\shell\Enqueue\command]
[HKEY_CLASSES_ROOT\WMP11.AssocFile.WAX\shell\Enqueue\command]
[HKEY_CLASSES_ROOT\WMP11.AssocFile.WMV\shell\Enqueue\command] 
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

Here, I'm wanting to add a key called command with a String value of "DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}" to all five registry keys listed. Would the above syntax work to do this?

Hashim

Posted 2016-11-07T02:58:31.470

Reputation: 6 967

It has been several days since we heard from you. Did you need any additional information? If so, would be glad to chime in. If not, were you going to mark the answer as accepted, or did you prefer to leave it open for additional feedback? – Run5k – 2016-11-17T04:59:59.743

Answers

1

I believe that you want to add Windows Registry Editor Version 5.00 as the first line of your .reg file, have a blank line, then proceed with each individual HKEY_CLASSES_ROOT entry immediately followed by a separate "DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}" line for each one. Essentially, utilize another blank line followed by the next HKEY_CLASSES_ROOT entry with its own "DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}" line on the subsequent line, etc. In other words, something like the following:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\WMP11.AssocFile.MP4\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.m3u\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.MPEG\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.WAX\shell\Enqueue\command]
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

[HKEY_CLASSES_ROOT\WMP11.AssocFile.WMV\shell\Enqueue\command] 
"DelegateExecute"="{45597c98-80f6-4549-84ff-752cf55e2d29}"

As always, backup the appropriate area of the registry before you make any changes!

Run5k

Posted 2016-11-07T02:58:31.470

Reputation: 13 092

Could you give this in code form? – Hashim – 2016-11-07T03:40:32.903

I have updated my answer accordingly. – Run5k – 2016-11-07T03:45:59.650

Thanks so much, makes it much easier to visualise. The code itself is pretty much what I already came up with in the initial version of the script I'm working on, and it's what made me ask the question: I was wondering if there was a way to add the same value to different keys without repeating the value each time. I'm sure I've seen it done, I'm not entirely positive how. – Hashim – 2016-11-07T03:48:24.767

Always glad to help. – Run5k – 2016-11-07T03:49:33.150