Command-line Options


Parameters for winscp.exe executable:

winscp.exe site|workspace|folder
winscp.exe <session_url>[/path/[file]]
winscp.exe [mysession] [/newinstance]
winscp.exe [mysession] /edit <path>
winscp.exe [mysession] /synchronize [local_directory] [remote_directory] [/defaults]
winscp.exe [mysession] /keepuptodate [local_directory] [remote_directory] [/defaults]
winscp.exe [mysession] /upload file1 file2 file3 ... [/defaults]
winscp.exe [mysession] [/privatekey=<key_file>] [/hostkey=<fingerprint>]
winscp.exe [mysession] [/passive[=on|off]] [/implicit|explicit]
winscp.exe [mysession] [/timeout=<sec>]
winscp.exe [mysession] [/rawsettings setting1=value1 setting2=value2 ...]
winscp.exe [/console] [/script=script_file] [/command command1 command2 ...] [/parameter // param1 ...]
winscp.exe [/log=<logfile>  [/loglevel=<level>]] [/xmllog=<logfile> [/xmlgroups]]
winscp.exe [/ini=<inifile>]
winscp.exe [/rawconfig config1=value1 config2=value2 ...]
winscp.exe /batchsettings <site_mask> setting1=value1 setting2=value2 ...
winscp.exe /update
winscp.exe /help

Parameters for executable: [/script=script_file] [/command command1 command2 ...] [/parameter // param1 ...] [/log=<logfile> [/loglevel=<level>]] [/xmllog=<logfile> [/xmlgroups]] [/nointeractiveinput]
winscp.exe [/ini=<inifile>]
winscp.exe [/rawconfig config1=value1 config2=value2 ...] /help


The first syntax opens the site. To open site, stored in folder, use path syntax “folder/site”. You can also open workspace or all sites in site folder.


The second creates the session specified by session URL and optionally by initial remote path. If the remote path is not ended by slash (/), it is treated as path to file (or even directory) that should be downloaded.

If there’s already idle WinSCP instance running, the session(s) opens in the existing instance. To force session open in new instance of WinSCP, use /newinstance parameter.

Parameter /privatekey specifies local path to SSH private key file.

Parameter /timeout specifies server response timeout.

Parameter /hostkey specifies fingerprint of expected SSH host key (or several alternative fingerprints separated by semicolon). It makes WinSCP automatically accept host key with the fingerprint.

Parameter /passive enables passive (=on) or active (=off) transfer mode (FTP protocol only).

Parameters /implicit, and /explicit (/explicittls in the earlier versions) enable respective method of invoking FTPS.

Parameter /rawsettings allows configuring any site settings using raw format as in an INI file. E.g. to enable SSH compression and agent forwarding use /rawsettings Compression=1 AgentFwd=1. The parameter must come after session URL (if any).

When using scripting, use open command (and its switches) instead. This allows you settings script options before starting session.

winscp.exe "My site"
winscp.exe s /hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
winscp.exe scp:// /privatekey=mykey.ppk
winscp.exe ftps://


With /log parameter you may turn on session logging to file specified by local path.

Use parameter /loglevel to change logging level. The value can be in range 0..2 (for Normal, Debug 1 and Debug 2 logging levels respectively). Append additional * to enable password logging (e.g. /loglevel=2*). This feature is available only in the latest release.

winscp.exe s /log="C:\winscp.log" /loglevel=0

With /xmllog parameter you may turn on XML logging to file specified by local path.1) In either path you can use the same patterns as in the logging preferences.

Use parameter /xmlgroups along with /xmllog, to group all XML log elements belonging to the same command under parent group element.

Console/scripting mode

Parameter /console executes WinSCP in console (scripting) mode. Note that when using, the console mode is implicit, so using /console parameter is redundant.

To run batch script either pass script file using /script parameter or specify the commands directly on command line using /command. In the latter case each following parameter is treated as single command. See syntax section and examples below for details how to deal with spaces and double-quotes.

If both /script and /command parameters are used, commands from script file are executed first. When the last command is not exit, regular non-batch mode follows.

Use parameter /parameter to specify list of arguments to be passed to script. It is recommended to escape the arguments with // switch.

With winscp.exe, if /console parameter is not used along with /script or /command, the script/command is executed without visual feedback (window).

Use parameter /nointeractiveinput, when feeding commands to using standard input, to make sure prompts for anything other than commands (such as password prompts) are cancelled. Also prevents error message popping up when fatal error occurs while starting WinSCP. When combined with /xmllog the fatal error is recorded in the XML log. /script="C:\Users\martin\Documents\myscript.txt" /command "option batch abort" "option confirm off" "open s -hostkey=""ssh-rsa 2048 xx:xx:xx...""" "exit"
winscp.exe /console /script="myscript.txt" /log="myscript.log"


The following parameters can be used to create a shortcut that initiates operation in GUI mode. They are not intended for automation, for that see scripting.

Use /edit to open a remote file in WinSCP internal editor.

With /synchronize or /keepuptodate parameter WinSCP performs Synchronize or Keep remote directory up to date commands respectively on the specified session and directories. A dialog to set options is displayed first.

With /upload parameter WinSCP uploads specified files to initial remote directory of session2). A dialog to set options is displayed first.

Use /defaults parameter along with /upload, /synchronize or /keepuptodate to skip the settings dialog and start the operation straight away with default settings.

It is recommended to escape the arguments with // switch.

winscp.exe /defaults /synchronize // "C:\Users\martin\Documents\MySite" /home/martin/public_html


With /ini parameter you may specify local path to configuration INI file. It effectively disables using registry as configuration storage. If the file does not exist, default configuration will be used and the file will be created.

winscp.exe /ini="C:\Users\martin\Documents\myconfig.ini"

Use nul instead of path to force WinSCP start with its default configuration and not save the configuration on exit.

With /rawconfig parameter you can set any configuration settings using raw format as in an INI file. E.g. to configure an external IP address use /rawconfig Interface\ExternalIpAddress= The parameter must come after a session URL (if any). The configuration set this way is preserved.

Mass-modification of sites

Use /batchsettings to mass-modify stored sites. The first argument is a mask to select sites to modify. Use a syntax of basic file masks. You can also use path mask to select sites based on their folders. The other arguments define new values for site settings. Use the same syntax as for /rawsettings.

For example to configure a proxy for all sites in a “clients” folder, use:

winscp.exe /batchsettings clients/* ProxyMethod=3 ProxyHost=proxy


When run with /update parameter, WinSCP only checks for its updates.

Parameter /help shows usage (overview similar to this).


Command-line parameters that include space(s) must be surrounded by double-quotes:

winscp.exe /ini="C:\Users\martin\Documents\myconfig.ini"

To use the double-quote as a literal, use two double-quotes sequentially. For example, the /command expects that each script command is surrounded by double quotes, so that it is passed as a single command-line argument. In addition, any script command argument that includes spaces is expected to be surrounded by double-quotes within the command (see doubling double-quotes): /command "open s -hostkey=""ssh-rsa 2048 xx:xx:xx:...""" "put ""C:\Users\martin\Documents\my file.dat"""
                    <-                       Script command 1                      -> <-             Script command 2              ->

To debug the quoting, enable session logging on level Debug 1 (/loglevel=1). The log will show how WinSCP understands your command-line. This feature is available only in the latest release.

An argument that begins with a slash is considered a switch. To pass a parameter that itself starts with the slash in its syntax (i.e. a remote path like /root), use the special switch // (two slashes) before the argument. The switch // denotes that all following arguments are not switches. Example:

winscp.exe /synchronize // "C:\Users\martin\Documents\MySite" /root


Learn about two WinSCP executables, winscp.exe and


If you are going to run WinSCP from command-line often, you may wish to add WinSCP installation directory to search path.

1) For backward compatibility, XML logging can also be enabled using /log parameter with filename ending with .xml extension.
2) Parameter is primarily intended to allow Windows Explorer's 'Send To' menu integration
  commandline.txt · Last modified: by prikryl

Search Documentation

This page


About donations

$9   $19   $49   $99

About donations



Site design by Black Gate