ERRORLEVEL is 0 on Network error
i'm using the WINSCP.EXE to download files and i'm not seeing an ERRORLEVEL 1 if there is a network error.
in my BAT file:
in the script file:
in the log file:
any ideas on how to capture this error? thanks.
in my BAT file:
"C:\Program Files\WinSCP\winscp.exe" /script=%ScriptPath% /log=%LogFilePath% IF ERRORLEVEL 1 goto error :error @Echo Send Error Email as a warning to the operations team Goto End
in the script file:
option batch abort option confirm off open user:password@non-existentServerIP -hostkey="ssh-rsa...." ... close exit
in the log file:
. 2012-11-20 14:18:01.196 -------------------------------------------------------------------------- . 2012-11-20 14:18:01.196 WinSCP Version 4.2.9 (Build 938) (OS 5.2.3790 Service Pack 2) . 2012-11-20 14:18:01.196 Login time: Tuesday, November 20, 2012 2:18:01 PM . 2012-11-20 14:18:01.196 -------------------------------------------------------------------------- . 2012-11-20 14:18:01.196 Session name: session name removed . 2012-11-20 14:18:01.196 Host name: ###.###.###.### (Port: 22) . 2012-11-20 14:18:01.196 User name: username (Password: Yes, Key file: No) . 2012-11-20 14:18:01.196 Tunnel: No . 2012-11-20 14:18:01.196 Transfer Protocol: SFTP (SCP) . 2012-11-20 14:18:01.196 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec . 2012-11-20 14:18:01.196 Proxy: none . 2012-11-20 14:18:01.196 SSH protocol version: 2; Compression: No . 2012-11-20 14:18:01.196 Bypass authentication: No . 2012-11-20 14:18:01.196 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No . 2012-11-20 14:18:01.196 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No . 2012-11-20 14:18:01.196 SSH Bugs: -,-,-,-,-,-,-,-,- . 2012-11-20 14:18:01.196 SFTP Bugs: -,- . 2012-11-20 14:18:01.196 Return code variable: Autodetect; Lookup user groups: Yes . 2012-11-20 14:18:01.196 Shell: default . 2012-11-20 14:18:01.196 EOL: 0, UTF: 2 . 2012-11-20 14:18:01.196 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes . 2012-11-20 14:18:01.196 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No . 2012-11-20 14:18:01.196 Local directory: default, Remote directory: home, Update: No, Cache: Yes . 2012-11-20 14:18:01.196 Cache directory changes: Yes, Permanent: Yes . 2012-11-20 14:18:01.196 DST mode: 1 . 2012-11-20 14:18:01.196 -------------------------------------------------------------------------- . 2012-11-20 14:18:01.196 Looking up host "###.###.###.###" . 2012-11-20 14:18:01.196 Connecting to ###.###.###.### port 22 . 2012-11-20 14:18:10.055 Failed to connect to ###.###.###.###: Network error: Connection timed out . 2012-11-20 14:18:12.618 Failed to connect to ###.###.###.###: Network error: Connection refused
any ideas on how to capture this error? thanks.