Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 蚂蚁';s exec在复制时返回一个错误_Java_Ant_Cmd_Exec - Fatal编程技术网

Java 蚂蚁';s 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

我需要连接两个文件。为此,我使用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 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之外工作