标题: [求助]关于reg add的/d参数问题
[打印本页]
作者: jgc
时间: 2007-1-7 08:18
标题: [求助]关于reg add的/d参数问题
比如,我要使用这个命令:
reg add hkcr\batfile\shell\test\command /ve /d "test.exe" "%1"
会返回错误: 命令行参数太多,因为它把中间的空格作为参数分隔了。
而
reg add hkcr\batfile\shell\test\command /ve /d ""test.exe" "%1""
和
reg add hkcr\batfile\shell\test\command /ve /d "" "test.exe" "%1"
也都无法执行。
所以,现在的问题是:如果我要用reg add命令加入一个有引号和空格的注册表项,该怎么做?(已搜索论坛,无果)
我不希望用regedit等命令,因为这就要增加临时文件。
希望能得到帮助,先谢谢了。
作者: everest79
时间: 2007-1-7 08:32
reg add hkcr\batfile\shell\test\command /ve /d "'test.exe' '%1'"
作者: jgc
时间: 2007-1-7 08:45
Quote: |
Originally posted by everest79 at 2007-1-7 08:32 AM:
reg add hkcr\batfile\shell\test\command /ve /d "'test.exe' '%1'" |
|
这样执行后值变成
'C:\test.exe' '%1'
在bat上右键test会弹出非法操作,而不是执行test.exe。
作者: 0401
时间: 2007-1-7 09:36
这样子:
reg add hkcr\batfile\shell\test\command /ve /d "\"test.exe\" \"%1\""
作者: jgc
时间: 2007-1-7 09:39
多谢四楼,成功。
作者: 6622186
时间: 2007-2-23 06:06
没想到 reg.exe 在关于输入的引号时候也t和 .reg 文件格式一样, 用 \" 代替内引号, 以前用 reg.exe 总不成功, 现在终于得到解决.
多谢四楼
作者: anqing
时间: 2007-2-23 06:23
四楼的用法,有谁可以讲解一下?
作者: slore
时间: 2007-2-23 08:17
做reg2bat时候,专门研究过……
reg add hkcr\batfile\shell\test\command /ve /d \"test.exe\"" \"%1\""