Introduction: Batch Login Screen

Picture of Batch Login Screen

Here's a small program which lets you register and login in batch hope you enjoy!

Step 1: Setting Up

Picture of 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

Picture of 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

Picture of 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

Picture of 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)

Comments

mrw122015 (author)2016-07-04

Very nice instructable! For some reason, the text file from onedrive does not work. Any way that you could please fix that. I would appriciate it! Thx!

Nasamos (author)mrw1220152016-07-05

here's a new link, although i did not have any problems with it maybe it's onedrive?

https://goo.gl/Gwye5t

mrw122015 (author)Nasamos2016-07-05

Thank You!

Nasamos (author)mrw1220152016-07-05

if there happens to be more problems just let me know,

thank you for submitting the error i'll make sure to use another site.

mrbi (author)2016-07-03

nice tutorial, you can write: if /l %logreg%==l goto login
in order to compare string case insensitive.

Nasamos (author)mrbi2016-07-03

the thing is i want to keep it as simple as possible with tutorials

DIY Hacks and How Tos (author)2016-07-02

Nice batch tutorial.

About This Instructable

1,243views

21favorites

Bio: i'm studying car mechanics @sint-jozefinstituut Geel, English is not my native language...
More by Nasamos:Batch login screenSaving & Loading variables in batch (external file(s))
Add instructable to: