发出包含多行的单个命令

时间:2014-06-09 11:15:32

标签: windows batch-file

我想在Windows批处理文件中执行以下行:

CALL createdoc.bat --create=yes --summary="my summary goes here" --publisher="my publisher name goes here" --website="my website address" --details="details.doc" --license="license.doc" --tocfile="../../../toc.doc"

当参数个数超过3时,该行很长。我尝试了以下方法使批处理文件看起来干净,易于阅读。

CALL createdoc.bat --create=yes \
                   --summary="my summary goes here" \
                   --publisher="my publisher name goes here" \
                   --website="my website address" \
                   --details="details.doc" --license="license.doc" \
                   --tocfile="../../../toc.doc"

然而它不起作用。 cmd不理解它们是单独的命令。我的问题是:如何使我的批处理文件看起来干净但仍然得到" cmd"了解构成单个命令的CALL行。

4 个答案:

答案 0 :(得分:1)

不支持“\”,你需要在反斜杠之前放一个“^”,(^)。

我不是说它会起作用。

答案 1 :(得分:1)

CALL createdoc.bat --create=yes ^
  --summary="my summary goes here" ^
  --publisher="my publisher name goes here" ^
  --website="my website address" ^
  --details="details.doc" --license="license.doc" ^
  --tocfile="../../../toc.doc"

答案 2 :(得分:0)

(^)这是一个错误,你必须放(^\),因为\用于指定磁盘中的路径,但我不确定。

以下是所有例外情况: http://www.robvanderwoude.com/escapechars.php

答案 3 :(得分:0)

\字符通常用于MAC OS X来分隔行。在Windows操作系统上,您可以使用^而不是\ character

相关问题