'c# Registry can't open Subkey with {} [closed]

Here is my code

RegistryKey = regsohr;
regsohr = Registry.LocalMachine.OpenSubKey(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{DFDC1B83-7FD3-4C77-8CD1-7391D1680ACA}");
sw.WriteLine(regsohr.GetValue("Path"));

It can't get into {DFDC1B83-7FD3-4C77-8CD1-7391D1680ACA}. But when I delete that line everything works fine. Anyone has any ideas why it can't open this SubKey? I will appreciate any help.



Solution 1:[1]

My bad. I have messed up with "HKEY_LOCAL_MACHINE".

regsohr = Registry.LocalMachine.OpenSubKey(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{DFDC1B83-7FD3-4C77-8CD1-7391D1680ACA}");

Fixed it

regsohr = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{DFDC1B83-7FD3-4C77-8CD1-7391D1680ACA}");

Solution 2:[2]

Try this , for example i put it in a Label to check if it works

{
    string readValue;
    readValue = My.Computer.Registry.GetValue
     (@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache", "Tasks",Nothing);
    Label6.Text = readValue;
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 iosiph
Solution 2 Leonardo Alves Machado