使用WinSCP在批处理文件中使用带空格的路径 [英] Use path with spaces in batch file using WinSCP

查看:213
本文介绍了使用WinSCP在批处理文件中使用带空格的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已创建WinSCP批处理文件以删除远程服务器上的文件.它工作正常,但不适用于带有空格的文件夹.

I have created WinSCP batch file for deleting files on remote server. It's working fine, but it's not working with folder with spaces.

例如,以下批处理文件正在工作:

For example, the below batch file is working:

cd C:\Program Files\WinSCP
winscp.com /command ^
    "open sftp://user:pwd@host" ^
    "cd /home/test/Desktop/india" ^
    "rm int.txt" ^ 

但是下面的批处理文件不起作用

but the below batch file is not working

cd C:\Program Files\WinSCP
winscp.com /command ^
    "open sftp://user:pwd@host" ^
    "cd /home/test/Desktop/india & nepal" ^
    "rm int.txt" ^ 

由于空间原因,我无法删除india & nepal文件夹文件

I am not able to delete india & nepal folder file because of space

任何人都可以提供解决方案吗?

Can any one give a solution?

推荐答案

用空格将双引号引起来的路径括起来:

Wrap the path with spaces to double double-quotes:

    "cd ""/home/test/Desktop/india & nepal""" ^

请参见 https://winscp.net/eng/docs/commandline#syntax

这篇关于使用WinSCP在批处理文件中使用带空格的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆