[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[注册表类] 批处理命令reg add如何添加reg_none类型的数据?

本帖最后由 hentai87 于 2023-4-18 18:42 编辑

这是是原本导出的正确数据
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SECURITY\Policy\Accounts\S-1-1-0\Privilgs]
@=hex(0):01,00,00,00,00,00,00,00,17,00,00,00,00,00,00,00,03,00,00,00
  1. reg add "HKEY_LOCAL_MACHINE\SECURITY\Policy\Accounts\S-1-1-0\Privilgs" /ve /t reg_none /d "01,00,00,00,00,00,00,00,17,00,00,00,00,00,00,00,03,00,00,00" /f
复制代码
这样导入的数据是错误的,无法直接用导出的数据直接reg add
reg add之后,数据不对,导出数据变了,错误的
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SECURITY\Policy\Accounts\S-1-1-0\Privilgs]
@=hex(0):68,00,65,00,78,00,28,00,30,00,29,00,3a,00,30,00,31,00,2c,00,30,00,30,\
  00,2c,00,30,00,30,00,2c,00,30,00,30,00,2c,00,30,00,30,00,2c,00,30,00,30,00,\
  2c,00,30,00,30,00,2c,00,30,00,30,00,2c,00,31,00,37,00,2c,00,30,00,30,00,2c,\
  00,30,00,30,00,2c,00,30,00,30,00,2c,00,30,00,30,00,2c,00,30,00,30,00,2c,00,\
  30,00,30,00,2c,00,30,00,30,00,2c,00,30,00,33,00,2c,00,30,00,30,00,2c,00,30,\
  00,30,00,2c,00,30,00,30,00,00,00

回复 2# chishingchan


    导入之后数据不对,逗号,空格,不加符号,都试过了,都不行

TOP

回复 4# newswan


    换成REG_BINARY,虽然数据对了,但是注册表设置没能生效,类型必须是reg_none

TOP

回复 6# yakeyun


    错误: 无效项名。
键入 "REG ADD /?" 了解用法信息。

TOP

回复 9# yakeyun


    类型必须是reg_none

TOP

回复 8# newswan


  [byte[]]$a = @("00","03","15")
New-ItemProperty -Path "HKLM:\SECURITY\Policy\Accounts\S-1-1-0\Privilgs" -Name "@" -Type None -Value $a

New-ItemProperty : 该属性已存在。
所在位置 行:1 字符: 1
+ New-ItemProperty -Path "HKLM:\SECURITY\Policy\Accounts\S-1-1-0\Privil ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceExists: (HKEY_LOCAL_MACH...-1-1-0\Privilgs:String) [New-ItemProperty], IOExcepti
   on
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.NewItemPropertyCommand

TOP

回复 9# yakeyun


    不用提权,我已经解锁了权限

TOP

回复 8# newswan


regedit.exe/s可以导入reg文件成功修改,但是我想不用额外文件,直接命令实现

TOP

回复 14# newswan

Remove-ItemProperty : 路径 HKEY_LOCAL_MACHINE\SECURITY\Policy\Accounts\S-1-1-0\Privilgs 处不存在属性 (Default)。
所在位置 行:1 字符: 1
+ Remove-ItemProperty -Path "HKLM:\SECURITY\Policy\Accounts\S-1-1-0\Pri ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: ((Default):String) [Remove-ItemProperty],PSArgumentException
    + FullyQualifiedErrorId : System.Management.Automation.PSArgumentException,Microsoft.PowerShell.Commands.RemoveIte
   mPropertyCommand

TOP

回复 16# newswan


    New-ItemProperty后的数据不对

TOP

回复 18# newswan


Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SECURITY\Policy\Accounts\S-1-1-0\Privilgs]
@=hex(0):00,03,0f

执行后,数据是这个

TOP

回复 20# newswan


[byte[]]$a = @("01","00","00","00","00","00","00","00","17","00","00","00","00","00","00","00","03","00","00","00")
Set-ItemProperty -Path "HKLM:\SECURITY\Policy\Accounts\S-1-1-0\Privilgs" -Name "(Default)" -Type None -Value $a
还是不对,明明是17,却变成了11
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SECURITY\Policy\Accounts\S-1-1-0\Privilgs]
@=hex(0):01,00,00,00,00,00,00,00,11,00,00,00,00,00,00,00,03,00,00,00
应该是17
@=hex(0):01,00,00,00,00,00,00,00,17,00,00,00,00,00,00,00,03,00,00,00

TOP

回复 22# newswan


    Set-ItemProperty : 无法将参数绑定到参数“Path”,因为该参数是空值。
所在位置 行:1 字符: 24
+ set-ItemProperty -Path $path -Name "(Default)" -Type None -Value $a
+                        ~~~~~
    + CategoryInfo          : InvalidData: ( [Set-ItemProperty],ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.SetItemProp
   ertyCommand

TOP

回复 24# newswan


    可以了,
有办法bat实现吗

TOP

返回列表