Target directory with space in PuTTY pscp via NAnt

时间:2017-07-12 08:05:03

标签: putty nant pscp

This target is OK (D:\Temp\sgr.tar.gz):

  <target name="myTarget" description="Download application delivery file">
    <exec program="pscp.exe">
        <arg line="-batch -v -l ${ftp.user} -pw ${ftp.password} ${ftp.host}:${remote.dir}/${remote.file} D:\Temp\sgr.tar.gz"/>
    </exec>
  </target>

This target (with a space in target directory (D:\tmp 2\sgr.tar.gz)) is KO:

  <target name="myTarget" description="Download application delivery file">
    <exec program="pscp.exe">
        <arg line="-batch -v -l ${ftp.user} -pw ${ftp.password} ${ftp.host}:${remote.dir}/${remote.file} D:\Temp\tmp 2.tar.gz"/>
    </exec>
  </target>

I have this error:

[exec] More than one remote source not supported

I try with but is KO also.

1 个答案:

答案 0 :(得分:2)

Wrap the path to double-quotes (&quot):

    <arg line="-batch -v -l ${ftp.user} -pw ${ftp.password} ${ftp.host}:${remote.dir}/${remote.file} &quot;D:\Temp\tmp 2.tar.gz&quot;"/>

See How to escape double quotes in XML attributes values?