在使用 Registry.GetValue(键,名称为null)
,而不是:
C:\Windows\system32
我想获取原始注册表项:
I would like to retrieve the raw registry entry:
%SystemRoot%\system32
这是可能的下用WinAPI的,但我不明白的方式来做到这一点与.NET。
This is possible in C with WinAPI, but I don't see a way to do that with .NET.
您需要通过它 RegistryValueOptions.DoNotExpandEnvironmentNames
。例如:
var key = @"SOFTWARE\Classes\.library-ms\ShellNew";
var name = "IconPath";
var regval = Registry.LocalMachine.OpenSubKey(key).GetValue(name, "",
RegistryValueOptions.DoNotExpandEnvironmentNames);
Console.WriteLine(regval);
输出为: %SYSTEMROOT%\ SYSTEM32 \ imageres.dll,-1001
output is: %SystemRoot%\System32\imageres.dll,-1001