Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Name: lee123abc
Hi, can anyone tell me why this login is messed up? If you type a space instead of the username and a space instead of the password, it lets you through!!! I dont understand where the error is. Cheers
echo off
cls
set password=123
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:login_name_password
:enter_username
cls
set login_name=
set /p login_name=Enter Login Name...
cls
:enter_password
set login_password=
set /p login_password=Enter password...
cls
echo.
echo You entered (%login_name%)
echo (%login_password%)
echo.
set login_accept=
set /p login_accept=To accept entries enter '1' or any other key to start over...
if '1' == '%login_accept%' (
goto login_process
) else (
goto login_name_password
)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:login_process
if /i '%username%' equ '%login_name%' (
goto login_process_password
) else (
goto login_process_error1
)
:login_process_password
if /i '%password%' equ '%login_password%' (
goto login_passed
) else (
goto login_process_error2
)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:login_process_error1
cls
echo.
echo You have typed in an incorrect Login Name. Please try again...
set login_name=
set /p login_name=Enter Login Name...
goto login_process
:login_process_error2
cls
echo.
echo You have typed in an incorrect Password. Please try again...
set login_password=
set /p login_password=Enter password...
goto login_process
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:login_passed
cls
echo.
echo Login process complete.
pause
pause

Here is a batch that works you will have to take some ideas and change things:-
@echo off
color 1A
set tries=4
:top
cls
set /a tries=%tries% -1
if %tries%==1 (
goto :last
)
echo.
echo.
echo You have %tries% attempts.
echo.
echo.
SET Choice=
SET /P Choice= Enter Password (no spaces):-^>
cls
IF /I '%Choice%'=='?Your password here?' (
GOTO :sdown
) else (
GOTO :next
)
:next
echo.
echo.
echo You have entered "%choice%" this is incorrect
echo %date% - %time% >>D:\IntLog.txt
echo %choice% >>D:\IntLog.txt
echo. >> D:\IntLog.txt
echo.
@ping -n 4 127.0.0.1>nul
cls
GOTO :top
:last
echo.
echo.
echo You have %tries% attempt left.
echo.
echo.
SET Choice=
SET /P Choice= Enter Password (no spaces):-^>
cls
IF /I '%Choice%'=='?Your password here?' (
GOTO :sdown
) else (
GOTO :next1
)
:next1
echo.
echo.
echo You have entered "%choice%" this is incorrect
echo %date% - %time% >>D:\IntLog.txt
echo %choice% >>D:\IntLog.txt
echo. >> D:\IntLog.txt
echo.
@ping -n 4 127.0.0.1>nul
cls
echo.
echo.
echo PASSWORD IS NOT VALID.
echo.
echo GO TO Mr SMITHERS AND ASK FOR PASSWORD
@ping -n 4 127.0.0.1>nul
GOTO :eof
:sdown
echo.
echo.
echo Don't worry Internet Explorer is starting
start "" "C:\Program Files\Internet Explorer\iexplore.exe" http://www.google.co.uk/
cls
::End

I KNOW WHAT YOU MEAN!!!
Try this out though...
NB ** run this batch from command prompt otherwise it WONT work ***
Type 'login username 123' and enter.
It seems harder to crack than any other method so far.@ECHO OFF
CLS
:USERNAME
IF /I "%USERNAME%" == "%1" (
GOTO PASSWORD
) ELSE (
GOTO ERROR
)
:PASSWORD
IF "%2" == "123" (
ECHO WELCOME %USERNAME%
ECHO YOU ARE NOW LOGGED ON...
PAUSE
GOTO END
) ELSE (
GOTO ERROR
)
:ERROR
ECHO YOU TYPED INCORRECT USERNAME/PASSWORD.
ECHO PLEASE TRY AGAIN.
GOTO END
:END

The only people that can't crack that in under 2 seconds would be ones that don't know about the type or more command or a text editor, i.e those that have never used a computer.

If you want a secure login, you need to use encrypted passwords that are stored in database.
Putting the password into a batch file is utterly useless/pointless.

I did try learning Microsoft Access... but it never worked, so I gave up on that. I do see that anyone can just edit the bat file and get the password! Anyway, it was just a simple idea that I wanted to do for a colleague that wanted a bat file for something.
I suppose I may have gone overboard with the login bit.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |