I have a registry path of the following
HKEY_LOCAL_MACHINE\SOFTWARE\COMPANY\COMPFOLDER
inside COMPFOLDER
, I have a string value called "Deno" whose value is 0. I wish to change its value to 1 by code whenever I execute the code. Can anyone help me?
Execute regedit to start Registry Editor. Anywhere you have command line access will work fine. See How to Open Registry Editor if you need help. On the left side of Registry Editor, locate the key you want to rename or the key that contains the value you want to change in some way.
The Windows Registry Editor (regedit) is a graphical tool in the Microsoft Windows operating system (OS) that enables authorized users to view the Windows registry and make changes.
It's been a while I did reg hacks, but something like this could work:
RegistryKey myKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Company\\Compfolder", true); if(myKey != null) { myKey.SetValue("Deno", "1", RegistryValueKind.String); myKey.Close(); }
using (RegistryKey key = regKeyRoot.OpenSubKey(KeyName, true)) // Must dispose key or use "using" keyword { if (key != null) // Must check for null key { key.SetValue(attribute, value); } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With