Q:

Make a batch login/register system? Code to it?

I am trying to make this advanced batch-file which has a role of a simple login system, that means that you can register in this batch file, and your data is exported to another batch file, under variables, and when you login, the file with the variables is called, setting your password so you can login, and then do other stuff. All in one batch file with only passwords in external files. I tried to code all this, and it works until the step where you have to write your password to login: When i enter my password (for the example it's "nekav") (I am sure it is correct when i input) the batch file writes "nekav was unexpected/unattended" and closes.
P.S.: to save the password under a variable in another file, i used:echo set pass1=pass1a
(pass1a was the previously input password, for the registration)
Unable to find the error in the code, i have it all uploaded here:
http://pastebin.com/RLffPsqG
Can you please tell me, where is my error?

A:

I'm decently proud of this :)
This has two different files: login.bat which handles the login and login2.bat which handles the registration.
login.bat:
@echo off
choice /c:RL /m "Choose an option: Register (R) or Login (L).:
if errorlevel 2 goto login
if errorlevel 1 goto register
:register
start /wait C:\[path]\login2.bat
cls
goto login
:in
cls
echo Welcome %u%
echo.
echo Bla Bla Bla or start "a program"
pause
exit
:login
set /p u=Username
set /p p=Password

and login2.bat:
@echo off
:a
set /p a="Choose a Username"
set /p b="Choose a Password"
echo.
choice /m "Are you sure you would like your Username to be %a% and your Password to be %b%?"
if errorlevel 2 goto a
set q="if %%u%% equ %a% if %%p%% equ %b% goto in"
for /f "tokens=*" %%I in (%q%) do set m=%%I
echo %m% >>C:\[path]\login.bat
exit

The reason why :in, the label which handles what happens after you login successfully has to be in the middle instead of at the end of login.bat is so that the username/password combinations could be appended to the :login label. Obviously you could add other embellishments and change the name of the files, but this is my basic design.
Hope this helps!

