Introduction: Batch Login Screen
Here's a small program which lets you register and login in batch hope you enjoy!
Step 1: Setting Up
So what you need is a map with another map inside of it, this makes it easier for data reference
(see pic)
Step 2: The Starting Screen
Here we'll create the screen you'll see when opening the program
(NOTE: i typed 'cd Log-Data' in the code in the pic but this returns an error use 'Log' as map name)
@echo off
REM this refers to the second map you made, in this case the name of the map
REM as long as the program and the desired map are in the same directory you can simply type 'cd (map name)'
cd Log
:start
cls
color F0
REM this is for displaying the screen use your own creativity here to make it really shine
echo Login, Register
echo.
echo (L)ogin (R)egister
set /p logreg=""
if %logreg%==L goto login
if %logreg%==l goto login
if %logreg%==R goto register
if %logreg%==r goto register
:login
cls
:register
cls
Step 3: The Register Screen
So obviously after the user gave his input we want it to go somewhere,
here we'll handle the action took when the user wants to register as a new user!
(NOTE: we are starting from the :register command)
:register
cls
echo Register
echo.
echo Username?:
set /p user=""
REM we save the username in a .dll file in the Data map
REM together with the password
echo.
echo Password?:
set /p pass=""
REM we export it here
REM we use a dll file because it's harder to read as a user, you could save it in a txt too!
echo %pass% >%user%.dll
goto regsuccess
:regsuccess
cls
echo Successfully registered
echo.
echo %user%
echo.
echo %pass%
pause
goto start
Step 4: Login Screen; Login Fail; Login Success
We want more than only being able to register a user we also want to make them login,
this will be done in this step!
(Note: We are starting from the :login command)
:login
cls
echo Login
echo.
echo Username?:
set /p user2=""
if Not exist %user2%.dll goto loginfail
for /f "Delims=" %%a in (%user2%.dll) do (
set passconfirm=%%a
)
echo.
echo Password?:
set /p pass2=""
if %pass2%==%passconfirm% goto loginsuccess
if not %pass2%==%passconfirm% goto loginfail
:loginsuccess
cls
echo success
echo.
echo Good job you successfully registered
echo and logged on to your account
pause
goto start
:loginfail
cls
echo failed
echo.
echo NOTE: it's case sensitive!
pause
goto start
Step 5: Download File (if You Want)
you can download the program if you really don't want to do it yourself
here: https://goo.gl/Gwye5t
(you still need to make the maps, this is only the txt file)