无法在reg文件中设置值

时间:2014-05-09 13:51:49

标签: batch-file registry

我正在尝试设置multi_sz值,但我的代码无效,我没有收到任何错误消息或类似信息。

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
"Start Page"="http://www.yahoo.com"
reg add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /t REG_MULTI_SZ /v "Secondary Start Pages" /d "http://www.bbc.co.uk\0http://www.superuser.com\0" /f

起始页面工作正常,问题是在尝试添加辅助起始页时。该值未更新(我猜表明存在错误)。我不知道出了什么问题

1 个答案:

答案 0 :(得分:1)

好像你试图将命令作为.reg文件运行,你可以使用这个:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
"Start Page"="http://www.yahoo.com"
"Secondary Start Pages"=hex(7):68,00,74,00,74,00,70,00,3a,00,2f,00,2f,00,77,00,\
  77,00,77,00,2e,00,62,00,62,00,63,00,2e,00,63,00,6f,00,2e,00,75,00,6b,00,00,\
  00,68,00,74,00,74,00,70,00,3a,00,2f,00,2f,00,77,00,77,00,77,00,2e,00,73,00,\
  75,00,70,00,65,00,72,00,75,00,73,00,65,00,72,00,2e,00,63,00,6f,00,6d,00,00,\
  00,00,00

这与批处理文件(名称“webpage_defaults.bat”并运行)相同:

@echo off
red add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v "Start Page" /t REG_SZ /d "http://www.yahoo.com" /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v "Secondary Start Pages" /t REG_MULTI_SZ /d "http://www.bbc.co.uk\0http://www.superuser.com\0" /f