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\winscp.com"
$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
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\winscp.com"
$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