Session

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.

Advertisements:

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 /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).

Logging

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.

Console/scripting mode

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 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.

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.

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=198.51.100.10. 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:

Auxiliary

Syntax

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):

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: