如何将multline REG_SZ字符串添加到命令行注册表? [英] How do I add a multline REG_SZ string to the registry from the command line?

查看:266
本文介绍了如何将multline REG_SZ字符串添加到命令行注册表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为Windows机器上生成设置的一部分,我需要添加注册表项,我想从一个简单的批处理文件做到这一点。

As part of a build setup on a windows machine I need to add a registry entry and I'd like to do it from a simple batch file.

该条目是第三方应用程序,以便该格式是固定的。

The entry is for a third party app so the format is fixed.

该条目需要一个REG_SZ字符串的形式,但需要包含换行符IE浏览器。 0xOA字符作为分隔符。

The entry takes the form of a REG_SZ string but needs to contain newlines ie. 0xOA characters as separators.

我已经打了几个问题。

第一次尝试使用注册表编辑器来加载生成的.reg文件。这种失败,因为它似乎并不喜欢或者要么长字符串或字符串用换行。我发现,出口正常工作导入失败。我能够为第三方应用直接通过Win32 API中增加了类似条目进行测试的出口。

First attempt used regedit to load a generated .reg file. This failed as it did not seem to like either either long strings or strings with newlines. I discovered that export works fine import fails. I was able to test export as the third party app adds similar entries directly through the win32 api.

第二次尝试使用的命令REG ADD,但我找不到反正添加新行charcters一切我尝试只是添加一个字符串结束。

Second attempt used the command REG ADD but I can't find anyway to add the newline charcters everything I try just ends up with a literal string being added.

任何想法?

推荐答案

您可以创建一个VBScript(.VBS)文件,只是把它从一个批处理文件,假设你在比此注册表其他批次做其他事情更改。在VBScript中,你会在看类似:结果
设置的WshShell =的CreateObject(WScript.Shell)

WSHShell.RegWriteHKEY_LOCAL_MACHINE \\ SOMEKEY,价值,型



您应该能够使用谷歌找到了可能的类型值。

You could create a VBScript(.vbs) file and just call it from a batch file, assuming you're doing other things in the batch other than this registry change. In vbscript you would be looking at something like:
set WSHShell = CreateObject("WScript.Shell")
WSHShell.RegWrite "HKEY_LOCAL_MACHINE\SOMEKEY", "value", "type"

You should be able to find the possible type values using google.

这篇关于如何将multline REG_SZ字符串添加到命令行注册表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆