• Hi Guest: Welcome to TRIBE, the online home of TRIBE MAGAZINE. If you'd like to post here, or reply to existing posts on TRIBE, you first have to register. Join us!

Registry editing via command line - multiline string datatype


TRIBE Member
I need to alter a multi-line string key (REG_MULTI_SZ) via command line/script.

I'm using REG ADD with the /f switch to overwrite the existing value.

The value itself is a list of dependent files.... problem is I dont know how to properly overwrite the file list, because the newline characters in my script are causing the command line to break.

ex: the data for the key value "Dependent Files" in the registry shows up as:

file3.cab <===== part of the multi-line string I need to get rid of

my command line is: REG add [KEY PATH] /v [KEY VALUE] /t REG_MULTI_SZ /d "file1.dll

Problem is, when I pop that into my command line it parses the newline char after file1.dll as end of line and processes (and fails, obv).

So I tried REG add [KEY PATH] /v [KEY VALUE] /t REG_MULTI_SZ /d "file1.dll file2.dll file4.dll" /f, but that created a single line in the key as "file1.dll file2.dll file4.dll"... i.e., it thinks the whitespace is part of the file, not seperate files (and obv craps out).

So how can I, using the REG command line util, create a multi-line string data set for a registry key?

It has to be via command line.


TRIBE Member
have you tried using the same line with each file seperately?

REG add [KEY PATH] /v [KEY VALUE] /t REG_MULTI_SZ /d "file1.dll"
REG add [KEY PATH] /v [KEY VALUE] /t REG_MULTI_SZ /d "file2.dll"
REG add [KEY PATH] /v [KEY VALUE] /t REG_MULTI_SZ /d "file4.dll"



TRIBE Member
That fully overwrites (or gives a prompt to overwrite if I don't use the /f switch) the entire value.

Also, keep in mind that the mulit-line set is actually made up of about 35-40 entries... so I'm tryign to avoid appending to the dataset in a series of commands... plus I'll need to do this abotu a dozen times for different servers.

It's like an array... the single key value is actually a series of strings separated by a CRLF character... only problem is that the command line hates the CRLF character and blows its wad before the true EOL.


TRIBE Member
Don't you need the /s separator to do this?

"/s separator : Specifies the character used to separate multiple instances of data. Used when REG_MULTI_SZ is specified as the data type and more than one entry needs to be listed. If not specified, the default separator is \0. "

syntax is
reg add KeyName [/v EntryName|/ve] [/t DataType] [/s separator] [/d value] [/f]
Last edited:


TRIBE Member
I think that was it.... I missed that switch on the documentation.

Anyway, I've already moved on, I altered the dataset via regedit GUI, exported the whole damn key as a .reg file, and run that at command line.

If they don't accept using the .reg file at command, I'll go back and see if the /s will do it. In the meantime, I wanna go home.
tribe cannabis goldsmith - gold cannabis accessories