commandline » Revisions »
Differences
This shows you the differences between the selected revisions of the page.
commandline 2023-05-23 | commandline 2025-04-13 (current) | ||
Line 1: | Line 1: | ||
====== Command-line Options ====== | ====== Command-line Options ====== | ||
- | |||
===== [[parameters]] Parameters ===== | ===== [[parameters]] Parameters ===== | ||
Parameters for ''[[executables|winscp.exe]]'' executable: | Parameters for ''[[executables|winscp.exe]]'' executable: | ||
- | &lt;code batch&gt; | + | <code batch> |
winscp.exe site|workspace|folder | winscp.exe site|workspace|folder | ||
- | winscp.exe &lt;session_url&gt;[/path/[file]] | + | winscp.exe <session_url>[/path/[file]] |
- | winscp.exe [mysession] [/sessionname=&lt;name&gt;] | + | winscp.exe [mysession] [/sessionname=<name>] |
winscp.exe [mysession] [/newinstance] | winscp.exe [mysession] [/newinstance] | ||
- | winscp.exe [mysession] /edit &lt;path&gt; | + | winscp.exe [mysession] /edit <path> |
- | winscp.exe [mysession] /browse[=&lt;file&gt;] | + | winscp.exe [mysession] /browse[=<file>] |
winscp.exe [mysession] /synchronize [local_directory] [remote_directory] [/defaults[=secs]] | winscp.exe [mysession] /synchronize [local_directory] [remote_directory] [/defaults[=secs]] | ||
winscp.exe [mysession] /keepuptodate [local_directory] [remote_directory] [/defaults[=secs]] | winscp.exe [mysession] /keepuptodate [local_directory] [remote_directory] [/defaults[=secs]] | ||
winscp.exe [mysession] /refresh [path] | winscp.exe [mysession] /refresh [path] | ||
winscp.exe [mysession] /upload file1 file2 file3 ... [/defaults[=secs]] | winscp.exe [mysession] /upload file1 file2 file3 ... [/defaults[=secs]] | ||
- | winscp.exe [mysession] [/privatekey=&lt;file&gt; [/passphrase=&lt;passphrase&gt;]] | + | winscp.exe [mysession] [/privatekey=<file> [/passphrase=<passphrase>]] |
- | winscp.exe [mysession] [/hostkey=&lt;fingerprint&gt;] | + | winscp.exe [mysession] [/hostkey=<fingerprint>] |
- | winscp.exe [mysession] [/username=&lt;user&gt;] [/password=&lt;pass&gt;] | + | winscp.exe [mysession] [/username=<user>] [/password=<pass>] |
winscp.exe [mysession] [/passwordsfromfiles] | winscp.exe [mysession] [/passwordsfromfiles] | ||
- | winscp.exe [mysession] [/clientcert=&lt;file&gt; [/passphrase=&lt;passphrase&gt;]] | + | winscp.exe [mysession] [/clientcert=<file> [/passphrase=<passphrase>]] |
- | winscp.exe [mysession] [/certificate=&lt;fingerprint&gt;] | + | winscp.exe [mysession] [/certificate=<fingerprint>] |
winscp.exe [mysession] [/passive[=on|off]] [/implicit|explicit] | winscp.exe [mysession] [/passive[=on|off]] [/implicit|explicit] | ||
- | winscp.exe [mysession] [/timeout=&lt;sec&gt;] | + | winscp.exe [mysession] [/timeout=<sec>] |
winscp.exe [mysession] [/rawsettings setting1=value1 setting2=value2 ...] | winscp.exe [mysession] [/rawsettings setting1=value1 setting2=value2 ...] | ||
- | winscp.exe [/console] [/script=&lt;script_file&gt;] [/command command1 command2 ...] | + | winscp.exe [/console] [/script=<script_file>] [/command command1 command2 ...] |
[/parameter // param1 ...] | [/parameter // param1 ...] | ||
- | winscp.exe [/log=&lt;logfile&gt; [/loglevel=&lt;level&gt;] [/logsize=[&lt;count&gt;*]&lt;size&gt;]] | + | winscp.exe [/log=<logfile> [/loglevel=<level>] [/logsize=[<count>*]<size>]] |
- | [/xmllog=&lt;logfile&gt; [/xmlgroups]] | + | [/xmllog=<logfile> [/xmlgroups]] |
- | winscp.exe [/ini=&lt;inifile&gt;] | + | winscp.exe [/ini=<inifile>] |
winscp.exe [/rawconfig config1=value1 config2=value2 ...] | winscp.exe [/rawconfig config1=value1 config2=value2 ...] | ||
winscp.exe [/rawtransfersettings setting1=value1 setting2=value2 ...] | winscp.exe [/rawtransfersettings setting1=value1 setting2=value2 ...] | ||
- | winscp.exe /batchsettings &lt;site_mask&gt; setting1=value1 setting2=value2 ... | + | winscp.exe /batchsettings <site_mask> setting1=value1 setting2=value2 ... |
- | winscp.exe /keygen keyfile [/output=&lt;file&gt;] [/changepassphrase] | + | winscp.exe /keygen keyfile [/output=<file>] [/changepassphrase] |
- | winscp.exe /keygen keyfile [/comment=&lt;text&gt;] [/certificate=&lt;file&gt;] | + | winscp.exe /keygen keyfile [/comment=<text>] [/certificate=<file>] |
+ | winscp.exe /copyid /identity=publickey mysession | ||
winscp.exe /update | winscp.exe /update | ||
winscp.exe /info | winscp.exe /info | ||
winscp.exe /help | winscp.exe /help | ||
- | &lt;/code&gt; | + | </code> |
Parameters for ''[[executables|winscp.com]]'' executable: | Parameters for ''[[executables|winscp.com]]'' executable: | ||
- | &lt;code batch&gt; | + | <code batch> |
winscp.com [/script=script_file] [/command command1 command2 ...] | winscp.com [/script=script_file] [/command command1 command2 ...] | ||
[/parameter // param1 ...] | [/parameter // param1 ...] | ||
winscp.com [/stdout[=binary|chunked]] [/stdin] | winscp.com [/stdout[=binary|chunked]] [/stdin] | ||
- | winscp.com [/log=&lt;logfile&gt; [/loglevel=&lt;level&gt;] [/logsize=[&lt;count&gt;*]&lt;size&gt;]] | + | winscp.com [/log=<logfile> [/loglevel=<level>] [/logsize=[<count>*]<size>]] |
- | [/xmllog=&lt;logfile&gt; [/xmlgroups]] [/nointeractiveinput] | + | [/xmllog=<logfile> [/xmlgroups]] [/nointeractiveinput] |
- | winscp.com [/ini=&lt;inifile&gt;] | + | winscp.com [/ini=<inifile>] |
winscp.com [/rawconfig config1=value1 config2=value2 ...] | winscp.com [/rawconfig config1=value1 config2=value2 ...] | ||
- | winscp.com /batchsettings &lt;site_mask&gt; setting1=value1 setting2=value2 ... | + | winscp.com /batchsettings <site_mask> setting1=value1 setting2=value2 ... |
- | winscp.com /keygen keyfile [/output=&lt;file&gt;] [/changepassphrase] | + | winscp.com /keygen keyfile [/output=<file>] [/changepassphrase] |
- | winscp.com /keygen keyfile [/comment=&lt;text&gt;] [/certificate=&lt;file&gt;] | + | winscp.com /keygen keyfile [/comment=<text>] [/certificate=<file>] |
+ | winscp.exe /copyid /identity=publickey mysession | ||
winscp.com /info | winscp.com /info | ||
winscp.com /help | winscp.com /help | ||
- | &lt;/code&gt; | + | </code> |
==== [[session]] Session ==== | ==== [[session]] Session ==== | ||
Line 62: | Line 63: | ||
The parameter ''/==sessionname=='' specifies a custom name of the session to be used instead of the automatically generated name in a format ''username@hostname'' or to override the name of the saved site. | The parameter ''/==sessionname=='' specifies a custom name of the session to be used instead of the automatically generated name in a format ''username@hostname'' or to override the name of the saved site. | ||
- | 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. | + | If there's already an idle WinSCP instance running, the session(s) opens in the existing instance. To force the session to open in a new instance of WinSCP, use ''/==newinstance=='' parameter. If no session is specified on command-line, [[ui_login|Login dialog]] opens to select one. |
The parameter ''/==privatekey=='' specifies a [[local_path|local path]] to an [[public_key#private|SSH private key file]]. If the key file is encrypted, use the ''/passphrase'' to specify its passphrase. The passphrase [[#passwordsfromfiles|can be read from a file]]. | The parameter ''/==privatekey=='' specifies a [[local_path|local path]] to an [[public_key#private|SSH private key file]]. If the key file is encrypted, use the ''/passphrase'' to specify its passphrase. The passphrase [[#passwordsfromfiles|can be read from a file]]. | ||
Line 70: | Line 71: | ||
You can use the parameters ''/==username=='' and ''/password'' as an alternative way to specify the credentials. The credentials are normally part of the [[session_url|session URL]]. Using these switches has the advantage of not needing to [[session_url#special|URL-encode special characters]]. The password [[#passwordsfromfiles|can be read from a file]]. | You can use the parameters ''/==username=='' and ''/password'' as an alternative way to specify the credentials. The credentials are normally part of the [[session_url|session URL]]. Using these switches has the advantage of not needing to [[session_url#special|URL-encode special characters]]. The password [[#passwordsfromfiles|can be read from a file]]. | ||
- | With parameter ''/==passwordsfromfiles=='', the values of [[#username|''/password'']], [[#privatekey|''/passphrase'']] and in general all passwords from all sources are interpreted as paths to files, where the actual passwords are read from. The files must use UTF-8 or UTF-16 encoding.((With UTF-8 encoding use of BOM is optional. With UTF-16 the BOM is mandatory. Only the first line of the file is considered. Use of more lines is reserved for the future.)) &beta_feature | + | With parameter ''/==passwordsfromfiles=='', the values of [[#username|''/password'']], [[#privatekey|''/passphrase'']] and in general all passwords from all sources are interpreted as paths to files, where the actual passwords are read from. The files must use UTF-8 or UTF-16 encoding.((With UTF-8 encoding use of BOM is optional. With UTF-16 the BOM is mandatory. Only the first line of the file is considered. Use of more lines is reserved for the future.)) |
The parameter ''/clientcert'' specifies a [[local_path|local path]] to FTPS or WebDAVS [[tls#client_certificate|TLS/SSL client certificate]]. If the certificate is encrypted, use the ''/passphrase'' to specify its passphrase. | The parameter ''/clientcert'' specifies a [[local_path|local path]] to FTPS or WebDAVS [[tls#client_certificate|TLS/SSL client certificate]]. If the certificate is encrypted, use the ''/passphrase'' to specify its passphrase. | ||
Line 150: | Line 151: | ||
Use ''/==defaults=='' parameter along with ''/upload'', ''/synchronize'' or ''/keepuptodate'' to skip the settings dialog and start the operation straight away with default settings. Alternatively you can specify a number of seconds, to actually show the settings dialogs, but have them automatically submit after the specified time elapses. | Use ''/==defaults=='' parameter along with ''/upload'', ''/synchronize'' or ''/keepuptodate'' to skip the settings dialog and start the operation straight away with default settings. Alternatively you can specify a number of seconds, to actually show the settings dialogs, but have them automatically submit after the specified time elapses. | ||
- | Use the ''/refresh'' parameter to reload remote panel of all running instances of WinSCP. If a session is specified on command-line, only instances that have that session as active are refreshed. If a path is specified after the ''/refresh'', only that directory is refreshed. | + | Use the ''/==refresh=='' parameter to reload remote panel of all running instances of WinSCP. If a session is specified on command-line, only instances that have that session as active are refreshed. If a path is specified after the ''/refresh'', only that directory is refreshed. |
It is recommended to escape the arguments with [[#syntax|// switch]]. | It is recommended to escape the arguments with [[#syntax|// switch]]. | ||
Line 193: | Line 194: | ||
Use ''/comment'' switch to change the key comment. | Use ''/comment'' switch to change the key comment. | ||
- | Use ''/certificate'' switch to add an certificate to the key. &beta_feature | + | Use ''/certificate'' switch to add an certificate to the key. |
For example, to convert key ''mykey.pem'' from OpenSSH format to ''mykey.ppk'' in PuTTY format and set its comment: | For example, to convert key ''mykey.pem'' from OpenSSH format to ''mykey.ppk'' in PuTTY format and set its comment: | ||
Line 207: | Line 208: | ||
</code> | </code> | ||
- | For a compatibility with *nix ''[[&man_ref(1,puttygen)|puttygen]]'', the ''-o'', ''-P'', ''-C'', ''%%--old-passphrase%%'' //(latest beta version only)// &beta and ''%%--certificate%%'' switches are understood as aliases to ''/output'', ''/changepassphrase'', ''/comment'', ''/passphrase'' and ''/certificate'' respectively. The ''%%--new-passphrase%%'' is recognized too //(beta only)//. &beta So, for features supported by WinSCP, you can use the same arguments as for ''puttygen'', just prefixed with ''/keygen'': | + | For a compatibility with *nix ''[[https://manpages.debian.org/stable/putty-tools/puttygen.1.en.html|puttygen]]'', the ''-o'', ''-P'', ''-C'', ''%%--old-passphrase%%'' and ''%%--certificate%%'' switches are understood as aliases to ''/output'', ''/changepassphrase'', ''/comment'', ''/passphrase'' and ''/certificate'' respectively. The ''%%--new-passphrase%%'' is recognized too. So, for features supported by WinSCP, you can use the same arguments as for ''puttygen'', just prefixed with ''/keygen'': |
<code batch> | <code batch> | ||
winscp.com /keygen mykey.pem -o mykey.ppk -C "Converted from OpenSSH format" | winscp.com /keygen mykey.pem -o mykey.ppk -C "Converted from OpenSSH format" | ||
</code> | </code> | ||
+ | |||
+ | ==== [[copyid]] Public key installation ==== | ||
+ | |||
+ | Use the ''/copyid'' switch to [[guide_public_key#configure_openssh|install your public key in a server's ''authorized_keys'' file]]. Use ''/identity'' switch to specify the path to your key pair in PPK format or public key in ''authorized_keys'' format. Supported with SFTP protocol only. | ||
+ | |||
+ | For example, to install public key from ''mykey.ppk'' key pair file, use: | ||
+ | |||
+ | <code batch> | ||
+ | winscp.com /copyid /identity=mykey.ppk martin@example.com | ||
+ | </code> | ||
+ | |||
+ | The functionality is a replacement for [[&man_ref(1,ssh-copy-id)|OpenSSH ''ssh-copy-id'' script]]. Contrary to the OpenSSH script, it does not require shell interpreter locally. Additionally, it uses SFTP protocol, so it does not rely on a shell access and shell commands on the server. For a compatibility with the script, the ''-i'' switch is understood as an alias to ''/identity''. So, for features supported by WinSCP, you can use the same arguments as for ''ssh-copy-id'', just prefixed with ''/copyid''. | ||
==== [[auxiliary]] Auxiliary ==== | ==== [[auxiliary]] Auxiliary ==== |