Java 蚂蚁';s exec在复制时返回一个错误
我需要连接两个文件。为此,我使用Ant的exec,但我得到以下错误Java 蚂蚁';s exec在复制时返回一个错误,java,ant,cmd,exec,Java,Ant,Cmd,Exec,我需要连接两个文件。为此,我使用Ant的exec,但我得到以下错误 production: [exec] Current OS is Windows 7 [exec] Executing 'cmd' with arguments: [exec] 'copy /B destination\bin\installer.sh+destination.tar.gz Installer.bin' [exec] [exec] The ' characters around the executab
production:
[exec] Current OS is Windows 7
[exec] Executing 'cmd' with arguments:
[exec] 'copy /B destination\bin\installer.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 destination\bin\installer.sh+destination.tar.gz Installer.bin'"/>
</exec>
</target>
如何修复此错误?试试这个
<target name="production" depends="tar" >
<exec dir="${bin}" executable="cmd">
<arg line="/C copy /B destination\bin\installer.sh+destination.tar.gz Installer.bin"/>
</exec>
</target>
您需要使用/C
来指示您正在将命令传递给cmd.exe您可以使用ant任务更轻松地完成此操作。不要忘记设置二进制
标志。作为奖励,这将在Windows之外工作