How to Format REG_MULTI_SZ Values in Regedit
This article explains the formatting rules for entering multiple text
strings into a REG_MULTI_SZ registry value using the
Windows Registry Editor (Regedit). In the graphical user interface,
strings are separated by standard line breaks, while the underlying
registry architecture stores them as a sequence of null-terminated
strings ending with an additional terminating null character.
The Line Break Rule in Regedit UI
When modifying a REG_MULTI_SZ (Multi-String Value) entry
inside Regedit:
- Double-click the
REG_MULTI_SZvalue to open the Edit Multi-String dialog box. - Enter each separate string on its own individual line.
- Press Enter after each entry to create the delimiter.
- Click OK to save the changes.
You do not need to manually type quotation marks, commas, semicolons, or null characters into the graphical dialog box. The text editor treats every press of the Enter key as the boundary between distinct string values.
Underlying Binary Structure
Under the hood, Windows stores REG_MULTI_SZ data as an
array of null-terminated strings:
- String Delimiter: Each string is terminated by a
single null character (
\0or0x0000in UTF-16LE). - Array Termination: The entire list is concluded
with an extra null character (
\0\0), signifying the end of the array. - Empty Lines: Creating an empty line in the middle
of the text box inserts an empty string (
\0), which can lead to unexpected behavior if an application reading the key interprets the first null sequence as the end of the list.
Formatting in .REG Files
If you export or manually create a .reg file containing
a REG_MULTI_SZ entry, it is formatted in hexadecimal
representation under the hex(7): type prefix.
Each character is written in UTF-16LE hex pairs, separated by commas:
* Letters are represented by their two-byte hex code (e.g.,
41,00 for “A”). * String boundaries are represented by a
null byte: 00,00. * The end of the entire multi-string
value is closed with an additional double null byte:
00,00,00,00.
Formatting via Command Line (REG.EXE)
When adding or modifying a REG_MULTI_SZ value using the
Command Prompt (reg.exe add), use the /s
parameter to define a custom separator, or separate values using
\0:
reg add "HKCU\Software\Example" /v "MyMultiString" /t REG_MULTI_SZ /d "FirstValue\0SecondValue\0ThirdValue" /fUsing standard line breaks in the graphical interface or explicitly using null-terminators via scripts ensures that Windows applications read the multi-string array correctly.