winscp.com: Network timeout error with errorlevel 0

Advertisement

Ups-auch-nicht-schlecht
Joined:
Posts:
2

winscp.com: Network timeout error with errorlevel 0

Hello,

I execute

winscp.com /command "option batch abort" "option confirm off" "option echo on"  "open scp://root:root@radio" "bye" & echo *** Errorlevel %ERRORLEVEL%

and expected - because the host is off - an errorlevel 1. I get the network timeout error, but an errorlevel 0:

batch           abort
reconnecttime   120
confirm         off
echo            on
open scp://root***@radio-maeuse
Searching for host...
Network error: Connection to "radio-maeuse" timed out.
*** Errorlevel 0

I'm using WinSCP.com, Version 5.6.1 (Build 4547) on Windows 7 64bit

Thanks, sincerely, Guido

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,517
Location:
Prague, Czechia

Re: winscp.com: Network timeout error with errorlevel 0

Your syntax is wrong. The %errorlevel% is resolved before whole line is executed. So what you are seeing is an exit code of previous command (line). In both cases.

Reply with quote

Ups-auch-nicht-schlecht
Joined:
Posts:
2

OK, trapped again in the expansion problem, this works, thanks, G.

setlocal enabledelayedexpansion 
winscp.com /command "option batch abort" "option confirm off" "option echo on"  "open scp://root:root@radio" "bye" & echo *** Errorlevel !ERRORLEVEL!

Reply with quote

Advertisement

You can post new topics in this forum