Been googling but I cant find out how to create a registry key itself, not a subkey string value as is seen in all the tutorials. The registry is like a tree with branches and leaves, I want to create a new branch and add a leaf
|tree
|-branch
| |-my branch
|-branch
Thanks for any help
More info to make it clearer as i'm being pointed to what I dont need ;)
you click on one of the registry keys, next to it is an arrow pointing down, you click it and you get more keys maybe with another arrow pointing down for more ketys, well thats what I'm trying to create a "folder" looking thing. I'm not sure how else I can explain but CreateSubKey
does nothing like that for me:
Key = Registry.CurrentUser.CreateSubKey("SOFTWARE\Microsof\game\addons\myaddons");
Now, when I check it there is no folder-like icon named myaddons
If you're creating a new registry key, right-click or tap-and-hold on the key it should exist under and choose New > Key. Name the new registry key and then press Enter.
To delete a registry path with all the subkeys, put a hyphen (-) in from of the registry path in the . reg file. To delete a single subkey put a hyphen (-) after the equals sign following the DataItemName in the . reg file.
Not sure if this is what you are trying to do, but you may use Registry.SetValue(string keyName, string valueName, object value, RegistryValueKind valuekind)
to create Keys/Subkeys and its values.
Example
Registry.SetValue(@"HKEY_CURRENT_USER\Software\Picrofo Software\", "", ""); //Tree
Registry.SetValue(@"HKEY_CURRENT_USER\Software\Picrofo Software\Subkey", "", ""); //Branch
Registry.SetValue(@"HKEY_CURRENT_USER\Software\Picrofo Software\Subkey", "Value Name", "Value", RegistryValueKind.String); //Branch's value
Registry.SetValue(@"HKEY_CURRENT_USER\Software\Picrofo Software\Another Subkey", "", ""); //Branch
This will create a key in HKEY_CURRENT_USER\Software\
with the name Picrofo Software
. Then, creates a subkey in the key we've created with the name Subkey
and sets a value of name Value Name
and its value Value
of type String
. Finally, creates another subkey in Picrofo Software
with the name Another Subkey
which has no specific value.
Thanks,
I hope you find this helpful :)
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