I really want to create login code in batch file that can authenticate users credentials, but by trying to google some stuff to make it work but i still can't, so i would like to ask some of professional coders, developers and programmers to help me and teach me about my mistakes since i'm still a student and newbie about programming.
Here's my code which is not authenticating after i created a new user and login in.
Please teach me well :<
@echo off
SETLOCAL EnableDelayedExpansion
MODE con: cols=51 lines=18
goto login
::Registration
:reg
cls
echo Create Account
echo.
set /p "uname=Username:"
set /p "pass=Password:"
echo Username: %uname% >> C:\Test\users.txt
echo Password: %pass% >> C:\Test\users.txt
goto login
::Login
:login
cls
echo Please Login. To create new account type "new".
echo.
set /p "uname=Username:"
if "%uname%"=="new" goto reg
set /p "pass=Password:"
call:authenticate
goto succ
::Error
:errorlogin
cls
echo Invalid credentials.
pause >nul
goto login
::Successful Login
:succ
cls
echo Login Successful
pause >nul
exit
::Copying/Backupping file and moving file after successful login
:copy
copy "C:\Users\userfile.sav" - "D:\Backup\"
copy "C:\Users\userfile.sett" - "D:\Backup\"
move "F:\unorthodox.exe" - "C:\Users\"
goto done
::final
:done
echo OOOOO OOOO O O OOOOO O
echo O O O O O O O O O
echo O O O O O O O OOO O
echo O O O O O OO O
echo OOOOO OOOO O O OOOOOO O
echo.
echo S U C C E S S F U L L Y
pause >nul
::====================================::
:authenticate
for /f "tokens=*" %%a in (users.txt) do (
if {%%a}=={%uname%}
if {%%a}=={%pass%} )
else
goto errorlogin
and i would like to mask the password with asterisk so that it's more like secure, also i would like to add loading screen indicating about copy/moving progress.
so much very thank you in advance.