设为首页 - 加入收藏 ASP站长网(Aspzz.Cn)- 科技、建站、经验、云计算、5G、大数据,站长网!
热搜: 创业者 手机 数据
当前位置: 首页 > 服务器 > 系统 > 正文

windows – 使用powershell更改注册表二进制数据

发布时间:2021-01-28 02:14 所属栏目:52 来源:网络整理
导读:我理解使用power shell可以更改注册表值. 例如,这里:http://poshcode.org/3504 我们可以像这样设置属性: Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\ftp\UserChoice' -name ProgId IE.FTP 但是,是否可以使用

我理解使用power shell可以更改注册表值.

例如,这里:http://poshcode.org/3504

我们可以像这样设置属性:

Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\ftp\UserChoice' -name ProgId IE.FTP

但是,是否可以使用powershell设置这些二进制值?

解决方法

>读取值(字节数组)
>修改数组元素
>将字节数组写回注册表项.

这是一个例子:

$key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections'

$data = (Get-ItemProperty -Path $key -Name DefaultConnectionSettings).DefaultConnectionSettings
$data[8] = 9
Set-ItemProperty -Path $key -Name DefaultConnectionSettings -Value $data

(编辑:ASP站长网)

    网友评论
    推荐文章
      热点阅读