Topic "filename with spaces in batchmode"

Author Message


I try to send a file to a SSH server in batchmode. The following command I have used:

winscp3.exe sftp://user@server /privatekey=key.ppk /log=logfile.txt /console /command "option batch on" "option confirm off" "option transfer ascii" "cd /transfer-dir" "put %1" "close" "exit"

%1 is a parameter of a batch file. This parameter contains a filename with a path. Sometimes the path contains space characters and the batch doesn't work. The %1 contains also "", but these characters seems not to be in the executed command line. How I can solve that problem?

[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26299
Location: Prague, Czechia
I'm not sure. It is rather Windows batch-file question. It is even possible (probable) that Windows shell does not support that. As an alternative you can create a temporary WinSCP script file by your batch file and run it.
Martin Prikryl

You can post new topics in this forum

Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License