This is an old revision of the document!
Command-line Options
Advertisement
Parameters
Parameters for winscp.exe
executable:
winscp.exe stored_session winscp.exe [(sftp|ftp|scp)://][user[:password]@]host[:port][/path/[file]] winscp.exe [session] /synchronize [local_directory] [remote_directory] [/defaults] winscp.exe [session] /keepuptodate [local_directory] [remote_directory] [/defaults] winscp.exe [session] /upload file1 file2 file3 ... [/defaults] winscp.exe [session] [/privatekey=<key_file>] [/hostkey=<fingerprint>] winscp.exe [session] [/timeout=<sec>] [/passive] winscp.exe [/console] [/script=script_file] [/command command1 command2 ...] winscp.exe /ini=<inifile> /log=<logfile> winscp.exe /update winscp.exe /help
Parameters for winscp.com
executable:
winscp.com [/script=script_file] [/command command1 command2 ...] winscp.com /ini=<inifile> /log=<logfile> winscp.com /help
Session
The first syntax opens the stored session (to open session, stored in folder, use path syntax “folder/session”).
Advertisement
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 (sftp://
, ftp://
or 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 /defaults
, /log
, /script
and /command
.
Parameter /privatekey
specifies private key file. You can use environment variables in the path, with syntax %NAME%
.
Parameter /timeout
specifies server response timeout.
Parameter /hostkey
specifies fingerprint of expected host key (or several fingerprints separated by semicolon). It makes WinSCP automatically accept hostkey with the fingerprint.
Parameter /passive
enables passive mode (FTP protocol only).
When using scripting, use open
command (and its switches) instead. This allows you settings script options before starting session.
With /log
parameter you may turn on session logging to given file. If the log file name has .xml
extension, XML logging is used. You can use environment variables in the path, with syntax %NAME%
.
Console/scripting mode
Parameter /console
executes WinSCP in console (scripting) mode. Note that when using winscp.com
, 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 (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.
With winscp.exe
, if /console
parameter is not used along with /script
or /command
, the script/command is executed without visual feedback (window).
Operations
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.
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 session1. 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.
Configuration
With /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 %NAME%
.
Advertisement
Auxiliary
When run with /update
parameter, WinSCP only checks for its updates.
Parameter /help
shows usage (overview similar to this).
Executables
Learn about two WinSCP executables, winscp.exe
and winscp.com
. Ну не песдетс, а?
Hint
If you are going to run WinSCP from command-line often, you may wish to add WinSCP installation directory to search path.
- Parameter is primarily intended to allow Windows Explorer’s ‘Send To’ menu integrationBack