This is an old revision of the document!
winscp.exe stored_session winscp.exe [(sftp|ftp|scp)://][user[:password]@]host[:port][/path/[file]] 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] [/implicit|explicitssl|explicittls] winscp.exe [mysession] [/timeout=<sec>] winscp.exe [/console] [/script=script_file] [/command command1 command2 ...] [/parameter param1 ...] winscp.exe /ini=<inifile> /log=<logfile> winscp.exe /update winscp.exe /help
winscp.com [/script=script_file] [/command command1 command2 ...] [/parameter param1 ...] winscp.com /ini=<inifile> /log=<logfile> winscp.com /help
The first syntax opens the stored session (to open session, stored in folder, use path syntax “folder/session”).
The second creates the session specified by at least hostname, optionally by name of protocol, port number, username, password and 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. Special characters (like
@ in username) can be encoded using
%XX syntax, where
XX is hexadecimal ASCII code.
For security reasons, when protocol (
scp://) is provided on command line (possible execution from web browser/Windows Explorer), all command-like parameters that cause any automatic action are ignored, including
/privatekey specifies private key file. You can use environment variables in the path, with syntax
/timeout specifies server response timeout.
/hostkey specifies fingerprint of expected host key (or several alternative fingerprints separated by semicolon). It makes WinSCP automatically accept hostkey with the fingerprint.
/passive enables passive mode (FTP protocol only).
/explicittls enable respective methods of invoking FTPS.
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. If the command includes spaces (most does), enclose it in double-quotes. If the command itself includes double-quotes (e.g. to enclose filename with spaces), double them.1
/command parameters are used, commands from script file are executed first. When the last command is not
exit, regular non-batch mode follows.
/parameter to specify list of arguments to be passed to script.
/console parameter is not used along with
/command, the script/command is executed without visual feedback (window).
The following parameters can be used to create shortcut that initiated operation in GUI mode. They are not intended for automation, for that see scripting.
/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.
/ini parameter you may specify 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. You can use environment variables in the path, with syntax
When run with
/update parameter, WinSCP only checks for its updates.
/help shows usage (overview similar to this).
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.