Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Commandline Path with spaces [solved]

To answer your original question, the code should be:
... "put ""D:\Fiserv Reports\Data\Output\CBA\NSW\PROD.CBA*"" /remotedir/remotesubdir/" ...

See https://winscp.net/eng/docs/commandline#syntax
poo_noo

I was able to work it out. I switched from winscp.exe to winscp.com and was able to call it from AutoHotkey
; 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
poo_noo

Commandline path with spaces [solved]

Hi all

Forgive me if I have missed something but I have the below code that works
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.
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