C# Create Values in Registry Local Machine

后端 未结 5 1791
闹比i
闹比i 2020-12-28 15:14

The following code is not working for me:

public bool createRegistry()
{
    if (!registryExists())
    {
        Microsoft.Win32.Registry.LocalMachine.Creat         


        
5条回答
  •  悲哀的现实
    2020-12-28 15:36

    Even when admin I don't think you can create new keys off LocalMachine. Make sure that you do

    Registry.LocalMachine.CreateSubKey(@"SOFTWARE\YourCompanyName\SomeNewKey");
    

    and not

    Registry.LocalMachine.CreateSubKey("SomeNewKey");
    

提交回复
热议问题