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|explicittls] 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 [/ini=<inifile>] [/log=<logfile>] [/xmllog=<logfile> [/xmlgroups]] winscp.exe [/rawconfig config1=value1 config2=value2 ...] winscp.exe /batchsettings <site_mask> setting1=value1 setting2=value2 ... winscp.exe /update winscp.exe /help
winscp.com [/script=script_file] [/command command1 command2 ...] [/parameter param1 ...] winscp.com [/ini=<inifile>] [/log=<logfile>] [/xmllog=<logfile> [/xmlgroups]] [/nointeractiveinput] winscp.exe [/rawconfig config1=value1 config2=value2 ...] winscp.com /help
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
For security reasons, when protocol (such as
sftp://) is provided as part of session URL (possible execution from web browser/Windows Explorer), all command-like parameters that cause any automatic action are ignored, including
/command. This restriction no longer applies in the latest beta version.
/timeout specifies server response timeout.
/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.
/explicit in the latest beta version) enable respective method of invoking FTPS.
/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.
winscp.exe "My site" winscp.exe sftp://martin:firstname.lastname@example.org/ /hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" winscp.exe scp://email@example.com:2222/ /privatekey=mykey.ppk winscp.exe ftps://martin:firstname.lastname@example.org/
/log parameter you may turn on session logging to file specified by local path. 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.
winscp.exe sftp://email@example.com/ /log="C:\winscp.log"
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.
/command parameters are used, commands from script file are executed first. When the last command is not
exit, regular non-batch mode follows.
/console parameter is not used along with
/command, the script/command is executed without visual feedback (window).
/xmlgroups along with
/xmllog, to group all XML log elements belonging to the same command under parent
/nointeractiveinput, when feeding commands to
winscp.com 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 (This feature is available only in the latest beta release.)
winscp.com /script="C:\Users\martin\Documents\myscript.txt" winscp.com /command "option batch abort" "option confirm off" "open sftp://firstname.lastname@example.org/ -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.
/edit to open a remote file in WinSCP internal editor. This feature is available only in the latest beta release.
/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.
/upload parameter WinSCP uploads specified files to initial remote directory of session2). A dialog to set options is displayed first.
/defaults parameter along with
/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
/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.
nul instead of path to force WinSCP start with its default configuration and not save the configuration on exit.
/rawconfig parameter you can set any configuration settings using raw format as in an INI file. The settings is identified using syntax
section\name, where the
section is a path to configuration section from
HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\Configuration key in a registry or
[Configuration] section in an INI file. E.g. to configure a reconnect interval use
/rawconfig Interface\SessionReopenAuto=10000. The parameter must come after a session URL (if any). The configuration set this way is preserved. This feature is available only in the latest beta release.
/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
For example to configure a proxy for all sites in a “clients” folder, use:
winscp.exe /batchsettings clients/* ProxyMethod=3 ProxyHost=proxy
This feature is available only in the latest beta release.
When run with
/update parameter, WinSCP only checks for its updates.
/help shows usage (overview similar to this).
Command-line parameters that include space(s) must be surrounded by double-quotes:
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):
winscp.com /command "open ""My site""" "put ""C:\Users\martin\Documents\myfile.dat""" <- script cmd 1 -> <- script cmd 2 ->
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,
If you are going to run WinSCP from command-line often, you may wish to add WinSCP installation directory to search path.
Site design by Black Gate