In this Instructable I will be showing a more complex batch programming than my previous one. This will show 1 way of the if command and how to make he program save files for you. Lets get started.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Using the If
This will show/tell you how to use the if I'll try to explain as i go along.
But we need to do something first, you see in the Program theres 'set /p userin1=' that will make 'userin1' what ever the user types so then with the 'if' it says (lets say userin1=hello but you will type %userin1%) 'if 'hello'=='hello' *command* so in the program it says:
if '%userin1%'=='no' goto new user. this shows that if the user types no then carry out this command with in this case is goto new user. And new user will make the user profile.
So if the player doesn't have a user account then it will make one. the next step will how you how you can do this.
Step 2: Saving Files
In this step i will show you how to save files with you batch program this will carry on with the other program.
the echo with this it wont project what on the line. It will save what ever the user typed for his/her username and password.
so lets say %username%=Io kieran oI then it will save Io kieran oI in username.txt same with the other one.
Step 3: How to Make the Program Only Accept the Username and Password
In this step, well its in the name.
right the set /p userin2=<username.txt makes what ever is in username.txt into a variable called %userin2% same with the password
then if the username is the same as what the person typed then carry on with the program
Step 4: DONE!
And thats it you have completed all you need to do is carry on with the program on how you want if you wish and comment of what you thing.
Io kieran oI out ;)