Menu  Toggle search  [ ![](https://winscp-
static-746341.c.cdn77.org/assets/images/logos/logo.png?v=7032) WinSCP  Free
SFTP, SCP, S3 and FTP client  for  Windows  ](https://winscp.net/)

  * [ Home ](/eng/index.php)
  * [ News ](/eng/news.php)
  * [ Introduction ](/eng/docs/introduction)
  * [ Download ](/eng/download.php)
  * [ Install ](/eng/docs/guide_install)
  * [ Documentation ](/eng/docs/)
  * [ Forum ](/forum/)

Close

Search

Close

[ Documentation ](/eng/docs/start "Documentation") » [ Features
](/eng/docs/feature_index "Features") » [ Scripting ](/eng/docs/scripting
"Scripting") » [ Script Commands ](/eng/docs/scripting#commands "Script
Commands") »

#  open command

Establishes new connection.

  * Syntax 
  * Remarks 
  * Examples 
  * Converting to .NET Assembly 

_Advertisement_

##  Syntax

    
    
    open <session_url>
    open <site>
    

##  Remarks

Establishes connection to given host. Use [ session URL
](/eng/docs/session_url) or name of the [ site
](/eng/docs/session_configuration#site) . To open site, stored in folder, use
path syntax “folder/site”. Using session  URL  is preferred as it makes your
script [ independent on the persisted configuration
](/eng/docs/scripting#configuration) . With session URL, you typically specify
a protocol, host name, username and password, optionally also a port number
and  SSH  host key fingerprint.

You can use _[ Generate Session URL/Code ](/eng/docs/ui_generateurl) _ command
to generate the ` open ` command for a given stored site.

Note that to allow the session be opened automatically without interaction,
you need to make sure you provide all details, including all credentials.
Generally, you need to provide a password in your [ session URL
](/eng/docs/session_url) or [ site ](/eng/docs/session_configuration#site) .
With [ SSH ](/eng/docs/ssh) you may alternatively use private key. With SSH, [
FTPS ](/eng/docs/ftps) or WebDAVS you need to [ verify the host or certificate
](/eng/docs/scripting#hostkey) .

Switches:

Switch  |  Description   
---|---  
` -privatekey=<file> ` |  [ SSH private key ](/eng/docs/public_key#private) path.   
Alternatively a hex dump of SSH private key file contents prefixed with ` @ `
.  
[ SFTP ](/eng/docs/sftp) and [ SCP ](/eng/docs/scp) protocols only.  
` -hostkey="<fingerprint>" ` |  Specifies fingerprint of expected [ SSH host key ](/eng/docs/ssh_verifying_the_host_key) (or several alternative fingerprints separated by semicolon). It makes WinSCP automatically [ accept host key ](/eng/docs/scripting#hostkey) with the fingerprint. Use  SHA-256  fingerprint of the host key. As the host key fingerprint contains spaces you need to surround it by quotes. _Learn how to[ obtain host key fingerprint ](/eng/docs/faq_hostkey) _ .   
Use the ` acceptnew ` keyword instead of the ` fingerprint ` to make WinSCP
automatically accept host key of new hosts. When this is combined with [ no
configuration mode ](/eng/docs/config#no) , it forces use of registry for the
host key cache.  
In exceptional situations, when security is not required, you can use value `
* ` to accept any host key. In this case, script output and log file will
include warning about insecure connection.  
[ SFTP ](/eng/docs/sftp) and [ SCP ](/eng/docs/scp) protocols only.  
` -clientcert=<file> ` |  [ TLS/SSL client certificate ](/eng/docs/tls#client_certificate) path.   
[ FTPS ](/eng/docs/ftps) and [ WebDAVS ](/eng/docs/webdav) protocols only.  
` -certificate="<fingerprint>" ` |  Specifies fingerprint of expected [ TLS/SSL certificate ](/eng/docs/tls#certificate) (or several fingerprints separated by semicolon). It makes WinSCP automatically [ accept certificate ](/eng/docs/scripting#hostkey) with the fingerprint. Use  SHA  -256 fingerprint of the certificate.   
In exceptional situations, when security is not required, you can use value `
* ` to accept any certificate. In this case, script output and log file will
include warning about insecure connection.  
[ FTPS ](/eng