PowerShell 技能连载 - 简单地读取注册表值

以下是最简单的读取注册表值的方法:

$Key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
$Name = 'RegisteredOwner'

$result = (Get-ItemProperty -Path "Registry::$Key" -ErrorAction Stop).$Name

"Registered Windows Owner: $result"

只需要将 $Key 替换成注册表项,将 $Name 替换成注册表键,就能读取它的值。

PowerShell 技能连载 - 简单地读取注册表值

https://blog.vichamp.com/2014/07/10/reading-registry-values-easily/

作者

Victor Woo

发布于

2014-07-10

更新于

2014-07-10

许可协议

PowerShell 技术 QQ 群