Naphstor
Naphstor

Reputation: 2496

SFTP transfer using WinSCP works on /command but fails on /script

I am trying to upload a file using WinSCP to a remote SFTP server. When I use the /command it works but when I use the same arguments in a script file using /script argument, it fails. Below is the cmd screenshot of /command argument working.

c:\winscp>WinSCP.com /command "open ftps://user:[email protected]/" "put filename.xml" "exit"
Connecting to sf-ftp.ebiaas.com:990 ...
TLS connection established. Waiting for welcome message...
Connected
Starting the session...
Session started.
Active session: [1] [email protected]
filename.xml         |           7 KB |   33.6 KB/s | binary | 100%

But when I do the same using /script, it fails.

c:\winscp>WinSCP.com /script="C:\Development\UploadData.txt" /log=log.txt
Connecting to sf-ftp.ebiaas.com:990 ...
TLS connection established. Waiting for welcome message...
Access denied.
Authentication failed.

The script file UploadData.txt contents are:

open ftps://user:[email protected]/
put filename.xml
exit

I am not sure if I am missing something or using the WinSCP client in a wrong way. I read here but it just says the access is denied if files on mapped drive fails. But then it should have failed in both the scenarios. There is another post here but not sure if that is same.

Any help would be appreciated.

Upvotes: 1

Views: 1255

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202282

Enable logging in both scripts using /log=c:\path\to\log.log switch. Also enable password logging with /loglevel=* switch.

See https://winscp.net/eng/docs/commandline#logging

And compare both log files to find what's causing the difference.

Upvotes: 1

Related Questions