21
15
How do I modify an existing registry key value from cmd?
There are a lot of options and switches, bells and whistles, for the Reg command. There are options to query, add, and delete keys, subkeys, and value names. But how do you modify the data of an existing value name? Do you completely remove the value name, and then add it again and re-type the modified value/data? That seems very cumbersome...
I am not interested in any script/batch automation, at least not now, I just want plain simple registry editing through cmd Reg command. Without the need to destroy a key just to add it a second later with some additional data. The same kind of operation you can do in Regedit.
Here's an example for you to spur the thinking process.
Key: HKEY_CURRENT_USER\Software\Citrix\Receiver
Value type: reg_sz
Value name: UpgradeDone
Value data: true
Now this one is just fine, but what if I must change the value data from "true" to "false". So that I get this instead:
Key: HKEY_CURRENT_USER\Software\Citrix\Receiver
Value type: reg_sz
Value name: UpgradeDone
Value data: false
What are the options and syntax for doing that from cmd?....
Update:
I just realized now that the example above might have been just too easy...
In the above example I can just do following:
reg delete HKEY_CURRENT_USER\Software\Citrix\Receiver /v UpgradeDone
reg add HKEY_CURRENT_USER\Software\Citrix\Receiver /v UpgradeDone /t Reg_Sz /d false
I can afford completely deleting the value, and then adding it again, because the data contained within it is very small. It's just a string like "true" or "false". That's not too hard to re-create.
Here's a harder example with more data content:
Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
Value name: Path
Value type: Reg_Sz
Data: C:\Program Files (x86)\ImageMagick-6.8.5-Q16;C:\PROGRA~2\GTK2-R~1\bin;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Windows\System32\WindowsPowerShell\v1.0\;"C:\Program Files (x86)\WinHasher";C:\Program Files (x86)\Android\android-sdk\tools\;C:\Program Files (x86)\Android\android-sdk\platform-tools\;C:\Program Files (x86)\GTK2-Runtime\bin;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\;C:\Program Files (x86)\Common Files\Teleca Shared;C:\Program Files (x86)\Notepad++
I want to remove only parts of the data content. Specifically, I only want to remove the last search path, the C:\Program Files (x86)\Notepad++.
How do you tackle this one??...
You don't expect me to re-type all this??......
Is your question specifically about editing PATH from the command line, or any value? Also, replacing or appending/prepending to any reg value is easy, but modifying/deleting parts of a value will require more effort. – Karan – 2013-06-14T16:17:35.643