我正在尝试从 Windows 中的注册表中获取一个值,该注册表位于几个分支下:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\...
给定以下代码:
RegistryKey openSubKey = settings.OpenSubKey(
@"\\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\DefaultSpoolDirectory");
openSubKey.SetValue("printername", "");
其中 settings 设置为 LocalMachine in Microsoft.Win32.Registry。
但是,在第一行代码之后我会得到 null 。是什么赋予了?