传递命令
我需要连接两个文件。我使用Ant的exec来实现这个目的,但是我得到了以下错误:
production:
[exec] Current OS is Windows 7
[exec] Executing 'cmd' with arguments:
[exec] 'copy /B destinationbininstaller.sh+destination.tar.gz Installer.bin'
[exec]
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.
[exec] Microsoft Windows [Version 6.1.7600]
[exec] Copyright (c) 2009 Microsoft Corporation. All rights reserved.
[exec]
任务如下:
<target name="production" depends="tar" >
<exec dir="${bin}" executable="cmd">
<arg line="'copy /B destinationbininstaller.sh+destination.tar.gz Installer.bin'"/>
</exec>
</target>
如何修复这个错误?
试试这个,
<target name="production" depends="tar" >
<exec dir="${bin}" executable="cmd">
<arg line="/C copy /B destinationbininstaller.sh+destination.tar.gz Installer.bin"/>
</exec>
</target>
您需要有/C
来指示您正在向cmd.exe
您可以使用ant concat任务来更轻松地完成此操作。不要忘记设置binary
标志。作为一个额外的好处,这将在Windows之外工作。