lundi 31 août 2015

DOS batch password protection?

I ended stuck with a batch for password protection of MS-DOS command prompt. Neighter way works properly. If it does not display syntax error, it can't go over even when typing in correct password. Here is the code:

@echo off
echo Computer password protected.
echo.

:PSW
set /p "PASS" = "Enter password: "
IF "%PASS%"=="kerberos" (
    echo Welcome.
    echo.
    goto EOF
) ELSE (
    echo Wrong password! Try again.
    echo.
    goto PSW
)

:EOF

I kept there the password as it is just a test if it is working properly and how it actualy works...

Aucun commentaire:

Enregistrer un commentaire