Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
At startup I want to make a login like page which users type their user ids and passwords, all users are assighned 6 character user ids. All user ids and passwords are saved in a file called password.dat at the root directory of C: and the structure of this file is designed as having one user id folloowed by two spaces and its passwords following by two spaces and the department that they are working at, in every row.

Use a real language like Pascal or C or even Assembly (something that will handle remapping Ctrl+C and Ctrl+Break interrupts so someone can't use them to break out of your program).

I have a project for my computer class and we have to use batch files to create a login page with a user id(6 characters) and password. I know that I need to use the set command and the if command and the call command, but I don't know how to put it all together and put it in the right order.

Adam,
DOS batch files are not designed for the type of thing you are (or rather your teacher)asking it to do. For one thing there is no built in way for DOS to handle input (at least the way your describing) from the user. You could probably download a COM from somewhere that will handle user input but I'm still not sure you would have the functionality you need to write the batch file. Tell your teacher he's crazy =). J/k.
-Michael

Actually if you write it in a real language you may impress your teacher and gain an "A". Since it's homework, I can't actually help you do any of it. If it's an assignment for a class, this must have already been discussed or is in a textbook. One suggestion if you're using real DOS (DOS 6.22 or earlier), try typing "help" from the command prompt and go looking through the commands available to you. And yes, set will be one of them I'm sure. Another place to check is Laurence's batch web page - to which I have the link at work, but I'm currently at home. It's very advanced and it'll probably require you to research what he's doing in a lot of the examples, but that's the whole point of a project anyway. I'll post that link (assuming Laurence doesn't beat me to it) when I get to work.

DoOMsdAY,
my batch file project is not homework. It is just an extra credit project. That is why the teacher hasn't explained anything to me. He is hoping that I will find all the necesary information on my own, but I have been searching and studying for days with no results. So I was wondering if you could help me piece some things together so I could understand better.
Thanks.

DOS wont operate inthis manner. It cannot manage the username,password,section for validation. What you could do is maybe write it so that it is like this ( my dos commands are noot too good, I get by but am not brilliant)
@echo off
echo *Login Batch File*
find {file.name} %1
if True goto step2 find {file.name} %2
if false echo try again
exit
step2:
find {file.name} %2
if true goto step3
if false echo Try again
exit
step3:
find {file.name} %3
if true goto home
if false echo try again
exit
home:
path=path+\%3\%1\
--------------------------------------------
where %1 is the name
%2 is the password
and %3 is the section.But it might not be too successful. You could give it a try though. I think thast Doomsdays idea of writing it in another language is better, C would be able to do it for you easily.
By the way the only reason I typed the batch file is that it probably wont work in this manner, the true false bit 2will have to be written correctly.

![]() |
sound driver
|
Formating c & d drive...
|

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