What is the Absolute Path to a Registry Value?

Marc George 21 Reputation points
2020-11-03T22:02:34.677+00:00

I am trying to update a registry key. However all I get from the numerous attempts with various coding is a 'System.ArgumentException' of 'Absolute path information is required.'

From the last example I found in documentation, the following will generate the error.

static void Test()
{
RegistryKey rkey = Registry.LocalMachine;
String [] names = rkey.GetSubKeyNames();
}

What is the current process to read and modify a system's registry?

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,591 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Jenny Feng 14,131 Reputation points
    2020-11-04T02:58:09.36+00:00

    @Marc George
    Hi,

    You could find the Windows registry information for advanced users here:
    https://support.microsoft.com/en-us/help/256986/windows-registry-information-for-advanced-users
    https://learn.microsoft.com/en-us/powershell/scripting/samples/working-with-registry-keys?view=powershell-7
    Hope above information can help you.

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. EckiS 831 Reputation points
    2020-11-04T17:46:08.933+00:00

    the key is "Windows NT", you are missing a space
    this works on my system:

     using (var rkey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"))
    {
        String[] names = rkey.GetSubKeyNames();
    }
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.