Recent versions of WinSCP log WinSCP exit code in scripting. At least the exit code WinSCP believes it will return at the moment it is closing the log file. In extreme cases it might change afterwards.
- martin
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
Checking Results
WinSCP returns exit code1
, when any command is interrupted due to an error or any prompt is answered Abort (even automatically in batch mode). Otherwise it returns the exit code 0. To further analyze results of scripted operations, you will find XML logging useful.
1
, when any command is interrupted due to an error or any prompt is answered Abort (even automatically in batch mode). Otherwise it returns the exit code 0
. To further analyze results of scripted operations, you will find XML logging useful.
1
will be shown in the log when there's an error or when you've select "abort" on a prompt. Otherwise on a fully successful transmission, the exit code will be 0
.
Status code: 0
<?xml version="1.0" encoding="UTF-8"?>
<session xmlns="https://winscp.net/schema/session/1.0" name="UC4" start="2011-01-21T15:41:02.959Z">
<download>
<filename value="/get_testing1.txt" />
<destination value="C:\Users\me\Desktop\get_testing1.txt" />
<result success="true" />
</download>
</session>
<result success="true" />
1
.
1
when the XML shows a success?
put
transfers all return a status code: 0
when it is successful, why doesn't the get
?
1
is end of file. So it is ok.
. 2011-01-11 10:21:52.192 --------------------------------------------------------------------------
. 2011-01-11 10:21:52.192 WinSCP Version 4.2.9 (Build 938) (OS 6.1.7600)
. 2011-01-11 10:21:52.192 Login time: Tuesday, January 11, 2011 10:21:52 AM
. 2011-01-11 10:21:52.192 --------------------------------------------------------------------------
. 2011-01-11 10:21:52.192 Session name: User_Name@ftpserver.com
. 2011-01-11 10:21:52.192 Host name: ftpserver.com (Port: 22)
. 2011-01-11 10:21:52.192 User name: User_Name (Password: Yes, Key file: No)
. 2011-01-11 10:21:52.192 Tunnel: No
. 2011-01-11 10:21:52.193 Transfer Protocol: SFTP
. 2011-01-11 10:21:52.193 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2011-01-11 10:21:52.193 Proxy: none
. 2011-01-11 10:21:52.193 SSH protocol version: 2; Compression: No
. 2011-01-11 10:21:52.193 Bypass authentication: No
. 2011-01-11 10:21:52.193 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2011-01-11 10:21:52.193 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2011-01-11 10:21:52.193 SSH Bugs: -,-,-,-,-,-,-,-,-
. 2011-01-11 10:21:52.193 SFTP Bugs: -,-
. 2011-01-11 10:21:52.193 Return code variable: Autodetect; Lookup user groups: Yes
. 2011-01-11 10:21:52.193 Shell: default
. 2011-01-11 10:21:52.193 EOL: 0, UTF: 2
. 2011-01-11 10:21:52.193 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2011-01-11 10:21:52.193 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2011-01-11 10:21:52.193 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2011-01-11 10:21:52.193 Cache directory changes: Yes, Permanent: Yes
. 2011-01-11 10:21:52.193 DST mode: 1
. 2011-01-11 10:21:52.193 --------------------------------------------------------------------------
. 2011-01-11 10:21:52.216 Looking up host "ftpserver.com"
. 2011-01-11 10:21:52.286 Connecting to 000.000.000.000 port 22
. 2011-01-11 10:21:52.459 Server version: SSH-2.0-WingFTPserver
. 2011-01-11 10:21:52.459 We believe remote version has SSH-2 ignore bug
. 2011-01-11 10:21:52.459 Using SSH protocol version 2
. 2011-01-11 10:21:52.459 We claim version: SSH-2.0-WinSCP_release_4.2.9
. 2011-01-11 10:21:52.504 Doing Diffie-Hellman group exchange
. 2011-01-11 10:21:52.798 Doing Diffie-Hellman key exchange with hash SHA-1
. 2011-01-11 10:21:52.877 Host key fingerprint is:
. 2011-01-11 10:21:52.877 ssh-rsa 1024 fc:92:54:e6:06:04:1a:97:8c:8c:cb:a7:72:e0:86:52
. 2011-01-11 10:21:52.877 Initialised Blowfish-128 CBC client->server encryption
. 2011-01-11 10:21:52.877 Initialised HMAC-SHA1 client->server MAC algorithm
. 2011-01-11 10:21:52.877 Initialised Blowfish-128 CBC server->client encryption
. 2011-01-11 10:21:52.877 Initialised HMAC-SHA1 server->client MAC algorithm
! 2011-01-11 10:21:53.185 Using username "User_Name".
. 2011-01-11 10:21:53.279 Prompt (6, SSH password, , &Password: )
. 2011-01-11 10:21:53.279 Using stored password.
. 2011-01-11 10:21:53.280 Sent password
. 2011-01-11 10:21:53.328 Access granted
. 2011-01-11 10:21:53.372 Opened channel for session
. 2011-01-11 10:21:53.662 Started a shell/command
. 2011-01-11 10:21:53.662 --------------------------------------------------------------------------
. 2011-01-11 10:21:53.662 Using SFTP protocol.
. 2011-01-11 10:21:53.662 Doing startup conversation with host.
> 2011-01-11 10:21:53.673 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2011-01-11 10:21:53.722 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2011-01-11 10:21:53.722 SFTP version 3 negotiated.
. 2011-01-11 10:21:53.722 We believe the server has signed timestamps bug
. 2011-01-11 10:21:53.722 We will use UTF-8 strings for status messages only
. 2011-01-11 10:21:53.722 Getting current directory name.
. 2011-01-11 10:21:53.722 Getting real path for '.'
> 2011-01-11 10:21:53.723 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2011-01-11 10:21:53.770 Type: SSH_FXP_NAME, Size: 23, Number: 16
. 2011-01-11 10:21:53.770 Real path is '/'
. 2011-01-11 10:21:53.770 Startup conversation with host finished.
< 2011-01-11 10:21:53.771 Script: Active session: [1] User_Name@ftpserver.com
> 2011-01-11 10:21:53.771 Script: option confirm off
< 2011-01-11 10:21:53.771 Script: confirm off
> 2011-01-11 10:21:53.771 Script: option transfer binary
< 2011-01-11 10:21:53.771 Script: transfer binary
> 2011-01-11 10:21:53.771 Script: get get_testing.txt
. 2011-01-11 10:21:53.771 Listing file "get_testing.txt".
> 2011-01-11 10:21:53.771 Type: SSH_FXP_LSTAT, Size: 25, Number: 263
< 2011-01-11 10:21:53.822 Type: SSH_FXP_ATTRS, Size: 37, Number: 263
. 2011-01-11 10:21:53.828 File: "/get_testing.txt"
. 2011-01-11 10:21:53.828 Copying "/get_testing.txt" to local directory started.
. 2011-01-11 10:21:53.828 Binary transfer mode selected.
. 2011-01-11 10:21:53.854 Opening remote file.
> 2011-01-11 10:21:53.854 Type: SSH_FXP_OPEN, Size: 33, Number: 515
< 2011-01-11 10:21:53.912 Type: SSH_FXP_HANDLE, Size: 27, Number: 515
> 2011-01-11 10:21:53.912 Type: SSH_FXP_FSTAT, Size: 27, Number: 776
> 2011-01-11 10:21:53.912 Type: SSH_FXP_READ, Size: 39, Number: 1029
. 2011-01-11 10:21:53.972 Storing reserved response
< 2011-01-11 10:21:54.077 Status code: 1
. 2011-01-11 10:21:54.077 4 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2011-01-11 10:21:54.077 Type: SSH_FXP_CLOSE, Size: 27, Number: 1540
> 2011-01-11 10:21:54.084 Script: exit
. 2011-01-11 10:21:54.084 Closing connection.
. 2011-01-11 10:21:54.084 Sending special code: 12
. 2011-01-11 10:21:54.084 Sent EOF message