我在output1
和output2
中得到了不同的结果。尽管第一个输出给我实际在注册表中看到的值,但后者只给我默认值。我错过了什么?
String output1 = Registry.GetValue(
@"HKEY_USERS\blobb", "beep", "nope!") as String;
String output2 = Registry.Users.GetValue(
@"blobb\beep", "nope!") as String;
我尝试了许多不同的输入字符串,但都没有给我正确的值。
Registry.GetValue()
方法似乎更为直接明了,但是问题在于我要访问的密钥路径在 "HKEY_USERS" 之后有个很繁琐的数字,在不同的计算机中该数字会有所不同。是否存在一种通用方法,可以访问例如 "HKEY_USERS\S-1-5-21-12345678\Software\Microsoft" 这样的路径?虽然数字可能不同,但 "所有" 计算机上其余部分都相同... - Konrad Viltersten