Connect [-s|-f|-l|-w[a|p]] <server>[:<port>] [,<username>, <password>]
Call a server and log in with given username and password or use anonymous login if username/password is omitted. You can add an optional port number separated by colon directly to the hostname.
There are three parameters that choose the FTP engine that is used to handle
the connection to override the preset choice from the options dialog:
RFC-FTP -f: This is the standard FTP protocol without encryption.
SSH/SFTP -s: A secure file transfer protocol which is based on the SSH (secure-shell) protocol (note that this is different from the SSL/FTPS variant)
FTPS -le: A secure implementation of the FTP protocol based on SSL (this is the explicit SSL variant via port 21 which uses the AUTH TLS command)
FTPS -li: A secure implementation of the FTP protocol based on SSL (this is the implicit SSL variant via port 990 that does not use the AUTH TLS command)
WININET -w: This is a different engine for the plain FTP protocol. It is based on Internet Explorer and could be used if you have trouble with the -f paratmer. Also, for WININET, it is possible to force an Active or Passive connection by using the -wp or -wa in the connect command.
Notes about SFTP:
When using SFTP connections with public/private keys, the <password> parameter of the Connect-command can have a special format: @"pub-keyfile|priv-keyfile|passphrase" (including the quotes), e.g. Connect "myhost", "user001", @"w:\files\id_dsa.pub|w:\files\id_dsa|secret"
The public private key files need to be in a format compatible with OpenSSH (e.g. generate them via the Linux ssh-keygen command or use putty-keygen to convert .ppk files to OpenSSH format). If you do not have a public key file available, you can use word NULL instead of a filename. If your private key does not use a passphrase, use an empty string, Connect -s "server", "user001", @"NULL|D:\ssh\id_rsa|"
See also: Disconnect, RasConnect
Examples:
Connect "ftp.myserver.com", "joedoe", "ThePwd_123"
Connect -wa "ftp.myserver2.com:10021", "joey", "Password_123"
Connect -s "sftp.myserver2.com", "joey", "Password_123"
Connect -s "sftp.myserver3.com", "joey", @"D:\ssh\id_rsa.pub|D:\ssh\id_rsa|Passphrase_234"
Connect -s "sftp.myserver3.com", "joey", @"NULL|D:\ssh\id_rsa|"
← Back to Script Commands