Selecting FTP protocol in WinSCP script

2019-06-01 08:01发布

问题:

Before scheduling script it is worth to check how it works. so from Command Prompt I have just run my batch file.

The server rejected SFTP connection, but it listens for FTP connections. Did you want to use FTP protocol instead of SFTP? Prefer using encryption.

Image:

As shown in the image above, I have specified that It is FTP file protocol. But It doesn't help.

So far I have looked up:

  • https://winscp.net/eng/docs/message_server_rejected_sftp_listens_for_ftp
  • https://winscp.net/eng/docs/ui_login

And It works fine on FileZilla as FTP. Therefore, I can eliminate the following possibilities:

  • Server unexpectedly closed network connection;
  • Network error: Connection refused;
  • Network error: Connection reset by peer;
  • Network error: Connection timed out.

And here is my .bat for reference:

C:\Program Files (x86)\winSCP\winSCP.com" /script="C:\test\Test.txt

And .txt:

option batch abort
option confirm off
open ***.**.**.**
lcd C:\Transfer\ToABCTest\
get -delete  /test_edi_in/*.txt
close
exit

回答1:

You have to specify the FTP protocol in the script using the ftp:// scheme in the session URL:

open ftp://***.**.**.**