How to Run winscp.exe in Console Mode

Advertisement

zhuhy
Guest

How to Run winscp.exe in Console Mode

Below are the GUI operation steps. How to write the commands for automated connection and file retrieval using cmd?
How to configure two different passwords in the cmd command line?
for example:
open sftp://username:[email protected]/
  • 6.png (88.15 KB, Private file)

Reply with quote

Advertisement

zhuhy
Guest

How to Run winscp.exe in Console Mode

this is run log。

. 2026-06-24 14:23:36.881 --------------------------------------------------------------------------
. 2026-06-24 14:23:36.881 WinSCP バージョン 6.5.6 (ビルド 16502 2026-03-25) (OS 10.0.19043 ? Windows 10 Pro)
. 2026-06-24 14:23:36.881 Configuration: nul
. 2026-06-24 14:23:36.881 Log level: Normal
. 2026-06-24 14:23:36.881 Local account: SGHGROUP\70****72
. 2026-06-24 14:23:36.881 Working directory: E:\tools
. 2026-06-24 14:23:36.881 Process ID: 26888
. 2026-06-24 14:23:36.903 Ancestor processes: WinSCP, cmd, explorer, ...
. 2026-06-24 14:23:36.903 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=6.5.6 /consoleinstance=_27424_978 "/log=E:\tools\WinSCP.log" "/ini=nul" "/command" "open sftp://70****72%40dev%4010.**.**.49:***@10.**.**.22:322/ -hostkey=""ssh-rsa 2048 pXHUCgdwVej1VB8fGRthK/1zqr50kFckDKiyQQhOeSk""" "option password dev001" "Your command 2" "exit"
. 2026-06-24 14:23:36.903 Time zone: Current: GMT+8 (China Standard Time), No DST
. 2026-06-24 14:23:36.903 Login time: 2026-06-24 14:23:36
. 2026-06-24 14:23:36.903 --------------------------------------------------------------------------
. 2026-06-24 14:23:36.903 Script: Retrospectively logging previous script records:
> 2026-06-24 14:23:36.903 Script: open sftp://70****72%40dev%4010.**.**.49:***@10.**.**.22:322/ -hostkey="ssh-rsa 2048 pXHUCgdwVej1VB8fGRthK/1zqr50kFckDKiyQQhOeSk"
. 2026-06-24 14:23:36.903 --------------------------------------------------------------------------
. 2026-06-24 14:23:36.903 Session name: 70****72@dev@10.**.**.49@10.**.**.22 (Ad-Hoc site)
. 2026-06-24 14:23:36.903 Host name: 10.**.**.22 (Port: 322)
. 2026-06-24 14:23:36.903 User name: 70****72@dev@10.**.**.49 (Password: Yes, Key file: No, Passphrase: No)
. 2026-06-24 14:23:36.903 Tunnel: No
. 2026-06-24 14:23:36.903 Transfer Protocol: SFTP
. 2026-06-24 14:23:36.903 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2026-06-24 14:23:36.903 Disable Nagle: No
. 2026-06-24 14:23:36.903 Proxy: None
. 2026-06-24 14:23:36.903 Send buffer: 262144
. 2026-06-24 14:23:36.903 Compression: No
. 2026-06-24 14:23:36.903 Bypass authentication: No
. 2026-06-24 14:23:36.903 Try agent: Yes; Agent forwarding: No; KI: Yes; GSSAPI: Yes
. 2026-06-24 14:23:36.903 GSSAPI: KEX: No; Forwarding: No; Libs: gssapi32,sspi,custom; Custom:
. 2026-06-24 14:23:36.903 Ciphers: aes,chacha20,aesgcm,3des,WARN,des,blowfish,arcfour; Ssh2DES: No
. 2026-06-24 14:23:36.903 KEX: ntru-curve25519,mlkem-curve25519,mlkem-nist,ecdh,dh-gex-sha1,dh-group18-sha512,dh-group17-sha512,dh-group16-sha512,dh-group15-sha512,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2026-06-24 14:23:36.903 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2026-06-24 14:23:36.903 Simple channel: Yes
. 2026-06-24 14:23:36.903 Return code variable: Autodetect; Lookup user groups: Auto
. 2026-06-24 14:23:36.903 Shell: default
. 2026-06-24 14:23:36.903 EOL: LF, UTF: Auto
. 2026-06-24 14:23:36.903 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2026-06-24 14:23:36.903 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2026-06-24 14:23:36.903 SFTP Bugs: Auto,Auto
. 2026-06-24 14:23:36.903 SFTP Server: default
. 2026-06-24 14:23:36.903 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2026-06-24 14:23:36.903 Cache directory changes: Yes, Permanent: Yes
. 2026-06-24 14:23:36.903 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2026-06-24 14:23:36.903 DST mode: Unix
. 2026-06-24 14:23:36.903 --------------------------------------------------------------------------
< 2026-06-24 14:23:36.903 Script: Looking up server...
. 2026-06-24 14:23:36.903 Looking up host "10.**.**.22" for SSH connection
. 2026-06-24 14:23:36.903 Connecting to 10.**.**.22 port 322
. 2026-06-24 14:23:37.019 Connected to 10.**.**.22 (from 10.20.19.20:57073)
< 2026-06-24 14:23:37.019 Script: Connecting to server...
. 2026-06-24 14:23:37.019 We claim version: SSH-2.0-WinSCP_release_6.5.6
. 2026-06-24 14:23:37.019 Connected to 10.**.**.22 (from 10.20.19.20:57073)
. 2026-06-24 14:23:37.135 Remote version: SSH-2.0-OpenSSH_7.6
. 2026-06-24 14:23:37.135 We believe remote version has SSH-2 RSA/SHA-2/certificate userauth bug
. 2026-06-24 14:23:37.135 Using SSH protocol version 2
. 2026-06-24 14:23:37.135 Have a known host key of type rsa2
. 2026-06-24 14:23:37.251 Doing ECDH key exchange with curve nistp384, using hash SHA-384 (unaccelerated)
. 2026-06-24 14:23:37.482 Host key fingerprint is:
. 2026-06-24 14:23:37.482 ssh-rsa 2048 SHA256:pXHUCgdwVej1VB8fGRthK/1zqr50kFckDKiyQQhOeSk
< 2026-06-24 14:23:37.482 Script: Authenticating...
. 2026-06-24 14:23:37.482 Host key matches configured key fingerprint
. 2026-06-24 14:23:37.482 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] outbound encryption
. 2026-06-24 14:23:37.482 Initialised HMAC-SHA-256 outbound MAC algorithm
. 2026-06-24 14:23:37.482 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] inbound encryption
. 2026-06-24 14:23:37.482 Initialised HMAC-SHA-256 inbound MAC algorithm
! 2026-06-24 14:23:37.582 Using username "70****72@dev@10.**.**.49".
< 2026-06-24 14:23:37.582 Script: Using username "70****72@dev@10.**.**.49"
. 2026-06-24 14:23:37.705 Server offered these authentication methods: password
. 2026-06-24 14:23:37.705 Prompt (password, "SSH password", <no instructions>, "Password(&P): ")
. 2026-06-24 14:23:37.705 Using stored password.
< 2026-06-24 14:23:37.705 Script: Authenticating with stored password
. 2026-06-24 14:23:37.705 Sent password
. 2026-06-24 14:23:38.469 Password authentication failed
! 2026-06-24 14:23:38.469 Access denied
< 2026-06-24 14:23:38.469 Script: Access denied
. 2026-06-24 14:23:38.469 Server offered these authentication methods: password
. 2026-06-24 14:23:38.469 Prompt (password, "SSH password", <no instructions>, "Password(&P): ")
. 2026-06-24 14:23:38.469 Prompting user for the credentials.
. 2026-06-24 14:23:38.469 Prompt cancelled.
. 2026-06-24 14:23:38.469 User aborted at password prompt
. 2026-06-24 14:23:38.469 Attempt to close connection due to fatal exception:
* 2026-06-24 14:23:38.469 **Authentication failed**
. 2026-06-24 14:23:38.469 Closing connection.
< 2026-06-24 14:23:38.501 Script: Authentication failed
< 2026-06-24 14:23:38.501 Authentication log (see session log for details):
< 2026-06-24 14:23:38.501 Using username "70****72@dev@10.**.**.49"
< 2026-06-24 14:23:38.501 Access denied
< 2026-06-24 14:23:38.501

< 2026-06-24 14:23:38.501 Authentication failed
  • 11.png (183.39 KB, Private file)
Description: Operation steps.The two passwords are different.

Reply with quote

zhuhy
Guest

How to Run winscp.exe in Console Mode

batch message

@echo off

"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="E:\WinSCP.log" /ini=nul ^
/command ^
"open sftp://70****72%%40dev%%4010.**.**.49:dev001@10.**.**.22:322/ -hostkey=""ssh-rsa 2048 pXHUCgdwVej1VB8fGRthK/1zqr50kFckDKiyQQhOeSk""" ^
"option password 123456" ^
"Your command 2" ^
"exit"

set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)
pause
exit /b %WINSCP_RESULT%

Reply with quote

Advertisement

You can post new topics in this forum