Can ERRORLEVEL detect a failed login

Advertisement

tbode2011
Joined:
Posts:
2

Can ERRORLEVEL detect a failed login

winscp.com /script=automate.txt /log="C:\WinSCP\logs\mylog.log"
IF ERRORLEVEL 0 GOTO SUCCESS
IF ERRORLEVEL 1 GOTO FAILED
:FAILED
ECHO Fail
GOTO DONE
:SUCCESS
ECHO SUCCESS
:DONE

----This is AUTOMATE.TXT----
option batch abort
option confirm off
open AAAAAAAAA:PPPPPPP@NN.NN.NN.NN:21
cd inbound
put C:\pm_server\qwerty\uiop\*.837
cd ..
cd outbound
get *.* C:\pm_server\qwerty\incoming\uiop\*.*
rm *.*
exit

When I run this with an invalid password I get
Access Denied
Authentication Failed
but the ERRORLEVEL is returned as 0

How can I detect a failed login?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: Can ERRORLEVEL detect a failed login

I have sent you an email.
_________________
Martin Prikryl

Reply with quote

tbode2011
Joined:
Posts:
2

Thanks for the quick solution

Note that IF ERRORLEVEL X means IF ERRORLEVEL >= X.

Martin,
I totally forgot the >= meaning. At one time I had the conditions reversed in their order but probably rearranged them for 'clarity'.

Reply with quote

Advertisement

You can post new topics in this forum