Question

How I can insert a newline using REG command in a MULTI SZ value?

This is what I've tried:

REG ADD "HKCU\Test" /V "Test Multi SZ" /T "REG_MULTI_SZ" /D "a\n b" /F

..But this is what I got:

enter image description here

http://img14.imageshack.us/img14/3038/grxd.jpg

enter image description here

This is what I want to reproduce using REG.exe:

The key:

enter image description here

enter image description here

Binary data:

enter image description here

The Regedit script:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Test]
"Test Multi SZ"=hex(7):61,00,00,00,62,00,00,00,00,00
Was it helpful?

Solution

Try this, line separator is \0:

reg add HKEY_CURRENT_USER\Test /t REG_MULTI_SZ /v "Test Multi SZ" /d "a\0b\0"

Enter reg add /? for help at the command line.


Example:

reg add HKEY_CURRENT_USER\Test /t REG_MULTI_SZ /v "Test Multi SZ" /d "red\0green\0blue\0dark grey\0"


reg query HKEY_CURRENT_USER\Test

HKEY_CURRENT_USER\Test
    Test Multi SZ       REG_MULTI_SZ    red\0green\0blue\0dark grey\0\0


Screenshots from regedit:

  • main window main window

  • edit binary window
    edit binary window

  • edit multiline window
    edit multiline window

OTHER TIPS

Try with hex values - it should be 0d 0a

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top