This is an old revision of the document!

Command-line Options

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

winscp3.exe stored_session
winscp3.exe [(scp|sftp)://][user[:password]@]host[:port][/path/[file]]
winscp3.exe [session] /upload file1 file2 file3 ...
winscp3.exe [session] /synchronize [local_directory] [remote_directory]
winscp3.exe [session] /keepuptodate [local_directory] [remote_directory]
winscp3.exe [session] /console [/script=script_file] [/command command1 command2 ...]
winscp3.exe /update
winscp3.exe /ini=<inifile>
winscp3.exe /help

Advertisement

The first syntax opens the stored session. The second creates the session specified by at least hostname, optionally by name of protocol, port number, username, password and initial remote path. In both cases, when only hostname is known, only Login dialog is shown with pre-filled hostname. Otherwise connection attempt is started immediately. If the remote path is not ended by slash (/), it is treated as path to file (or even directory) that should be downloaded.

With /upload parameter WinSCP uploads specified files to remote directory of session defined using one of the previous syntaxes. A dialog to set options is displayed first (Note that this is not intended for automation, see scripting, but to allow Explorer’s ‘Send To’ menu integration).

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 (Note that this is not intended for automation, see scripting).

Parameter /console executes WinSCP in console (scripting) mode. Note that when WinSCP is executed via console interface (WinSCP3.com), the /console parameter is not necessary.

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, enclose it in 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.

When run with /update parameter, WinSCP only checks for new program version on the program’s website.

With /ini parameter you may specify path to configuration INI file. It effectively disables using registry as configuration storage.

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

Last modified: by martin