Differences

This shows you the differences between the selected revisions of the page.

commandline 2024-06-24 commandline 2025-04-13 (current)
Line 33: Line 33:
winscp.exe /keygen keyfile [/output=<file>] [/changepassphrase] winscp.exe /keygen keyfile [/output=<file>] [/changepassphrase]
winscp.exe /keygen keyfile [/comment=<text>] [/certificate=<file>] 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
Line 50: Line 51:
winscp.com /keygen keyfile [/output=<file>] [/changepassphrase] winscp.com /keygen keyfile [/output=<file>] [/changepassphrase]
winscp.com /keygen keyfile [/comment=<text>] [/certificate=<file>] 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
Line 61: 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 211: Line 213:
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 ====
Line 227: Line 241:
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 [[scripting#quotes|doubling double-quotes]]): 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 [[scripting#quotes|doubling double-quotes]]):
<code batch> <code batch>
-winscp.exe /command "open sftp://... -hostkey=""ssh-rsa ...""" "put ""C:\my file.dat"""+winscp.com /command "open sftp://... -hostkey=""ssh-rsa ...""" "put ""C:\my file.dat"""
                    <-          Script command 1          -> <-  Script command 2  ->                     <-          Script command 1          -> <-  Script command 2  ->
</code> </code>
Line 234: Line 248:
<code batch> <code batch>
-winscp.exe /command "open sftp://... -hostkey=`"`"ssh-rsa ...`"`"" "put `"`"C:\my file.dat`"`""+winscp.com /command "open sftp://... -hostkey=`"`"ssh-rsa ...`"`"" "put `"`"C:\my file.dat`"`""
                    <-            Script command 1            -> <-    Script command 2    ->                     <-            Script command 1            -> <-    Script command 2    ->
</code> </code>

Last modified: by 44.214.20.31