REG添加REG_MULTI_SZ多行注册表值 [英] REG ADD a REG_MULTI_SZ Multi-Line Registry Value

查看:2117
本文介绍了REG添加REG_MULTI_SZ多行注册表值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

若要添加REG_MULTI_SZ多行注册表值,我可以

  reg.exe ADDHKLM \path\\ \\ to\registry\key/ v RegistryValue / t REG_MULTI_SZ / dabc\0def\0

这将添加(abc,def)。



但是如果我需要添加(abc,,def ),即之间的空项?



执行

  reg.exe ADDHKLM \path\to\registry\key/ v RegistryValue / t REG_MULTI_SZ / dabc\0\0def\0

解决方案

p>这可能是不可能使用reg添加,因为你试图设置的数据不正确地形成。 REG_MULTI_SZ值由空字符串终止 ,所以不允许有一个空字符串作为值的一部分。



如果你真的需要,并且在理解一些软件将无法读取密钥正确,你可以使用reg import。例如,以下文件创建一个在中间带有空字符串的值:

  Windows注册表编辑器版本5.00 

[HKEY_CURRENT_USER\software\harrytest]
test= hex(7):76,00,61,00,6c,00,75,00,65,00,31,00, 00,00,76,00,61,00,6c,00,75,\
00,65,00,32,00,00,00,00,00,66,00,61,00, 6c,00,75,00,65,00,34,00,00,00,76,00,\
61,00,6c,00,75,00,65,00,35,00, 00,00,00,00


To add a REG_MULTI_SZ multi-line registry value, i can do

reg.exe ADD "HKLM\path\to\registry\key" /v RegistryValue /t REG_MULTI_SZ /d "abc\0def\0"

which would add ("abc", "def").

But what if i need to add ("abc", "", "def"), i.e. an empty item in between?

Doing

reg.exe ADD "HKLM\path\to\registry\key" /v RegistryValue /t REG_MULTI_SZ /d "abc\0\0def\0"

gives me an "invalid parameter" error.

解决方案

This probably isn't possible using reg add, because the data you're trying to set is improperly formed. REG_MULTI_SZ values are terminated by an empty string, so having an empty string as part of the value is not allowed.

If you really need to, and on the understanding that some software won't be able to read the key correctly, you could use reg import instead. For example, the following file creates a value with an empty string in the middle:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\software\harrytest]
"test"=hex(7):76,00,61,00,6c,00,75,00,65,00,31,00,00,00,76,00,61,00,6c,00,75,\
  00,65,00,32,00,00,00,00,00,76,00,61,00,6c,00,75,00,65,00,34,00,00,00,76,00,\
  61,00,6c,00,75,00,65,00,35,00,00,00,00,00

这篇关于REG添加REG_MULTI_SZ多行注册表值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆