The error "Error changing directory", which you are getting is most probably caused by the lcd
command. In Windows, the current working directory cannot be an UNC path (the \\networkname
).
Instead of changing the current working directory, upload the file using a full path:
open ftps://ftpuser:password@hostname/ -explicit -certificate="key"
cd Results
put \\networkname\sharedfolder\folder\*
However if you actually need credentials for accessing the UNC path (the \\networkname
), you have to authenticate prior to running the WinSCP script.
The batch file will be like:
net use \\networkname\sharedfolder password /user:domain\username /savecred /p:yes
winscp.com /script=... /log=...
net use \\networkname\sharedfolder /delete
Credits: How to create MAP Drive by batch file.
You still need to use the full path with the put
command, instead of the lcd
though. Unless you map the UNC path to a drive letter.