Topic "winscp.com: Network timeout error with errorlevel 0"

Author Message
Ups-auch-nicht-schlecht
[View user's profile]

Joined: 2014-08-11
Posts: 2
Hello,

I execute

Code:
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:

Code:

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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
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.
_________________
Martin Prikryl
Ups-auch-nicht-schlecht
[View user's profile]

Joined: 2014-08-11
Posts: 2
OK, trapped again in the expansion problem, this works, thanks, G.

Code:

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

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License