通过 NAnt 在 PuTTY pscp 中使用 space 的目标目录
Target directory with space in PuTTY pscp via NAnt
这个目标是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>
这个目标(在目标目录 (D:\tmp 2\sgr.tar.gz
) 中有一个 space)是 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>
我有这个错误:
[exec] More than one remote source not supported
我试过但是也是KO。
将路径换成双引号 ("
):
<arg line="-batch -v -l ${ftp.user} -pw ${ftp.password} ${ftp.host}:${remote.dir}/${remote.file} "D:\Temp\tmp 2.tar.gz""/>
见How to escape double quotes in XML attributes values?
这个目标是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>
这个目标(在目标目录 (D:\tmp 2\sgr.tar.gz
) 中有一个 space)是 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>
我有这个错误:
[exec] More than one remote source not supported
我试过但是也是KO。
将路径换成双引号 ("
):
<arg line="-batch -v -l ${ftp.user} -pw ${ftp.password} ${ftp.host}:${remote.dir}/${remote.file} "D:\Temp\tmp 2.tar.gz""/>
见How to escape double quotes in XML attributes values?