Introduction: More Complex Batch Programming
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.
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 ;)
7 years ago
Could I use this in my game i'm creating as a login/sign up menu?
Reply 6 years ago
This isn't the best, as it shows the password you are entering. A hybrid Batch+VBS or Batch+Powershell would work much better.
8 years ago on Introduction
I wish you did a tutorial on how to set different usernames and passwords
10 years ago on Introduction
Very informative tutorial! Keep up the good work!
Reply 10 years ago on Introduction
thanks nice to hear that im helping other :)