使用 WinSCP 在批处理文件中使用带空格的路径
Use path with spaces in batch file using WinSCP
我已经创建了用于删除远程服务器上文件的 WinSCP 批处理文件。它工作正常,但它不适用于 spaces.
的文件夹
例如,下面的批处理文件正在运行:
cd C:\Program Files\WinSCP
winscp.com /command ^
"open sftp://user:pwd@host" ^
"cd /home/test/Desktop/india" ^
"rm int.txt" ^
但是下面的批处理文件不起作用
cd C:\Program Files\WinSCP
winscp.com /command ^
"open sftp://user:pwd@host" ^
"cd /home/test/Desktop/india & nepal" ^
"rm int.txt" ^
我无法删除 india & nepal
文件夹文件,因为 space
谁能给个解决办法吗?
带空格的路径需要wrapped to double double-quotes:
"cd ""/home/test/Desktop/india & nepal""" ^
另见 Why are some WinSCP scripting commands specified in a batch file not executed/failing?
我已经创建了用于删除远程服务器上文件的 WinSCP 批处理文件。它工作正常,但它不适用于 spaces.
的文件夹例如,下面的批处理文件正在运行:
cd C:\Program Files\WinSCP
winscp.com /command ^
"open sftp://user:pwd@host" ^
"cd /home/test/Desktop/india" ^
"rm int.txt" ^
但是下面的批处理文件不起作用
cd C:\Program Files\WinSCP
winscp.com /command ^
"open sftp://user:pwd@host" ^
"cd /home/test/Desktop/india & nepal" ^
"rm int.txt" ^
我无法删除 india & nepal
文件夹文件,因为 space
谁能给个解决办法吗?
带空格的路径需要wrapped to double double-quotes:
"cd ""/home/test/Desktop/india & nepal""" ^
另见 Why are some WinSCP scripting commands specified in a batch file not executed/failing?