【发布时间】:2012-09-23 19:29:44
【问题描述】:
这是一个简单的 bat 文件:
C:\temp>type a.bat
@echo off
rem try
echo %1
有些困难,我可以将a&b 作为参数传递给它:
C:\temp>a.bat a&b
a
'b' is not recognized as an internal or external command,
operable program or batch file.
C:\temp>a.bat "a&b"
"a&b"
参数有" 字符;我可以忍受它。但我不知道如何从 cygwin shell 调用它:
C:\temp>c:\cygwin\bin\sh
sh-4.1$ ./a.bat a&b
[1] 7760
a
sh: b: command not found
sh-4.1$ ./a.bat a\&b
a
'b' is not recognized as an internal or external command,
operable program or batch file.
[1]+ Done ./a.bat a
sh-4.1$ ./a.bat \"a\&b\"
"\"a
'b\""' is not recognized as an internal or external command,
operable program or batch file.
sh-4.1$ ./a.bat "a\&b"
a\
'b' is not recognized as an internal or external command,
operable program or batch file.
【问题讨论】:
-
从你的尝试中,
a\&b才有意义.. 应该可以工作.. 很奇怪 -
其余的都是随机的绝望行为 :)
标签: shell batch-file cygwin