Here is the snippet that pulls a LOCALMACHINE\SOFTWARE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string GetRegistryKey(string keyName) { | |
string currentKey = String.Empty; | |
using(RegistryKey key32 = Registry.LocalMachine.OpenSubKey("SOFTWARE\\JobTracker")) { | |
if (key32 != null) { | |
currentKey = key32.GetValue(keyName).ToString(); | |
} else { | |
using(var hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)) | |
using(var key64 = hklm.OpenSubKey(@ "SOFTWARE\JobTracker")) { | |
currentKey = key64.GetValue(keyName).ToString(); | |
} | |
} | |
} | |
return currentKey; | |
} |
Read more...