Skip to content

klink have always exit code 0 #546

@Albirew

Description

@Albirew

I'm trying to make a script where i can detect if password is wrong, but exit code is always 0.
Is there a way to change exit code if login failed for any reason?

you can try it too with a simple script (i test on a mikrotik device, hence the weird command):

@echo off
:loop
echo.
echo.
set /P "pwd=Enter password: "
if "%pwd%" == "end" goto :end
klink -auto-store-sshkey -batch -ssh -pw "%pwd%" admin@192.168.88.1 "/beep frequency=500 length=0.5"
echo exit code: %errorlevel%
echo.
echo.
timeout 3 >nul
goto :loop
:end
pause

results are like this:
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions