Topic "Commandline Path with spaces [solved]"

Author Message
poo_noo
[View user's profile]

Joined: 2014-04-16
Posts: 2
Location: Sydney Australia
Hi all

Forgive me if I have missed something but I have the below code that works
Code:
C:\Windows\system32\cmd.exe /c ""C:\Program Files (x86)\WinSCP\WinSCP.exe" /command "option batch abort" "open sftp://user:password@server/ -hostkey=""ssh-rsa myhostkey""" "put D:\PROD.CBA* /remotedir/remotesubdir/" "exit" "


.... but the code below here doesn't.
Code:
C:\Windows\system32\cmd.exe /c ""C:\Program Files (x86)\WinSCP\WinSCP.exe" /command "option batch abort" "open sftp://user:password@server/ -hostkey=""ssh-rsa myhostkey""" "put D:\D:\Fiserv Reports\Data\Output\CBA\NSW\PROD.CBA* /remotedir/remotesubdir/" "exit" "


Could someone advise how to wrap the path with a space in it? I have tried multiple variations but without success.

Note: I am calling this via a AutoHotkey script. Thanks in advance

Last edited by poo_noo on 2014-04-17 01:56; edited 2 times in total
poo_noo
[View user's profile]

Joined: 2014-04-16
Posts: 2
Location: Sydney Australia
I was able to work it out. I switiched from winscp.exe to winscp.com and was able to call it from AutoHotkey

Code:
; all the SFTP function
RunWait,
(LTrim Join`s
%ComSpec% /c ""%path2WINscp%" /command "option batch abort"
"open sftp://%user%:%pass%@%server%/ -hostkey=""%host_key%"""
"%ftp_cmd% ""%local_path%"" %remote_path%" "exit"
),,hide UseErrorLevel
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
To answer your original question, the code should be:
... "put ""D:\Fiserv Reports\Data\Output\CBA\NSW\PROD.CBA*"" /remotedir/remotesubdir/" ...

See http://winscp.net/eng/docs/commandline#syntax
_________________
Martin Prikryl
Advertisements

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!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License