Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to use a batch script and a .REG file to set up some custom services. Most of the keys are being set up properly, but I need to set the DependOnService key for some of the services, which is normally a multi-string. Is it possible to set this key from a .REG file, or will manual entry be required?

share|improve this question

1 Answer

up vote 2 down vote accepted

REG_MULTI_SZ data in .REG files must be encoded in hexadecimal. If the content never changes you can create a dummy item in your registry with the data, export it, and adjust that to your needs.

If it does change, it will probably be far easier to use the reg command included with Windows to add it. To do so, call reg in this format:

reg add <KEY> /v <NAME> /t REG_MULTI_SZ /d <DATA> /s <SEPERATOR>

The seperator switch is optional. If not used, the strings to be written should be seperated by the escape sequence for the null character (\0). For instance, to add a item named Flair to HKEY_LOCAL_ MACHINE\SOFTWARE\WhizBang\Excite-O-Rama with the strings foo, bar, and baz you would run:

reg add HKEY_LOCAL_ MACHINE\SOFTWARE\WhizBang\Excite-O-Rama /v Flair /t REG_MULTI_SZ /d foo\0bar\0baz

To seperate the data with commas instead, you would run:

reg add HKEY_LOCAL_ MACHINE\SOFTWARE\WhizBang\Excite-O-Rama /v Flair /t REG_MULTI_SZ /d foo,bar,baz /s ,

For more information, consult Microsoft's documentation of the reg command.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.