PowerShell "You must provide a value expression following the '/' operator" error when calling WinSCP.com PowerShell "You must provide a value expression following the '/' operator" error when calling WinSCP.com powershell powershell

PowerShell "You must provide a value expression following the '/' operator" error when calling WinSCP.com


Since the path and/or filename of the winscp.com executable contains whitespace, invoke it with the & operator:

& "C:\Program Files (x86)\WinSCP\WinSCP.com" /command "open user@myFTPServer:MyPort/MyPath/ -privatekey=myprivatekey.ppk" "put myfile.txt" "exit"

(assuming the command-line arguments to winscp.com are otherwise correct, of course)