Post a reply

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)


Topic review


Syntax for filenames with spaces

Hello -

I am having a heck of a time getting the right syntax for winscp when there are spaces in the file names. Works great with no spaces.
I tried replacing the backticks with double quotes, so it is double double quotes. Do I need the back ticks and double double quotes?

$winscp = "C:\Program Files (x86)\WinSCP\"
$ftpsite = "sftp://sitename:22 -privatekey=D:\Serverkey\key.ppk"
$ftpdirectory = "/remotefolder"
$outfile = "d:\winscp.out"
$filepath = "D:\path\name name.gpg"

[string] $cmdline1 = "& `"$winscp`" /command `"option batch abort`" `"option confirm off`" "
$cmdline1 += " `"open $ftpsite`" `"cd $ftpdirectory`" `"put $filepath`" `"exit`" > $outfile"

invoke-expression $cmdline1