Topic "Scripting for different port number"

Author Message


I know the default port for SFTP is 22, but what if the port is 2222? I am trying to write my first WinSCP script to connect to an external SFTP site for synching file folders (one they have with a local share here). I was able to use the winscp.exe gui to connect and browse the files (and get the hostkey), but need to automate this now. I have been reviewing the documentation on scripting, but have not seen the answer yet.

Ultimately this script will be run for an SSIS job which then further will use these files for data extraction, etc.

Thanks for the information.


In the Login-WinSCP screen, highlight the site you're connecting with/select manager/Generate Session URL.
Copy and paste to your script.
This should give you the command string along with :port value you've defined the site with.

Hope it helps.
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24755
Location: Prague, Czechia
@JJS Thanks for answering this.

Here is are links to documentation:

You can post new topics in this forum

Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License