REG ADD a REG_MULTI_SZ Multi-Line Registry Value

前端 未结 4 1998
你的背包
你的背包 2021-01-01 04:42

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\"
         


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-01 05:15

    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
    

提交回复
热议问题