用 PowerShell 读写注册表

HKEY_CURRENT_CONFIG\test\SideBySide\Winners\amd64_.netframework_31bf3856ad364e35_none_f5dd4e94975c8e4e
value=amd64.netframework31bf3856ad364e35nonef5dd4e94975c8e4efunctionResolve?Winners(value )
{
$base = “HKCU:\test\SideBySide\Winners\”

$t = dir ( $base + $value )
$t.GetType()   

<#
IsPublic IsSerial Name BaseType
——– ——– —- ——–
True False RegistryKey System.MarshalByRefObject

>

$t.Name

<#
HKEY_CURRENT_USER\test\SideBySide\Winners\amd64_.netframework_31bf3856ad364e35_none_f5dd4e94975c8e4e\6.3

>

$t.Property

<#
6.3.9600.16384
(default)

>

$t.GetValue("6.3.9600.16384")
$t.GetValue("")


$t2 = Get-Item  ( $base + $value )
$t2.GetType()
<#

IsPublic IsSerial Name BaseType
——– ——– —- ——–
True False RegistryKey System.MarshalByRefObject
#>

$t2.Name
$t2.Property
$t2.GetValue("")
$t2.SetValue("","6")
$t.GetValue("6.3.9600.16384")
$t.SetValue("6.3.9600.16384", 2, "binary" )
$key = ( $base + $value )
Get-RegistryValue $key "(default)"
Set-ItemProperty $key "(default)" "6.4"
$t2.Name
$t.Name
$t.PSChildName
Set-ItemProperty $key "(default)"  $t.PSChildName

}

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。