If you have no clue what batch is, but want to learn it, refer to the "Very Basic Batch Tutorial".
In this tutorial you will learn more advanced commands and how to use them to create an application.
Step 1: Variables Step (1/3)
When we create a variable, we are creating something that we want the computer to remember for us, something that we can use later on in a program;
we give the computer the value that we want to store and we give it a label to store it under.
we can create integers and strings using variables.
To create a variable you need to learn the SET command.
The SET command is what creates variables;
Type the following into your CMD:
'name' is the name of the variable, and 'hello' is what the variable is storing
so now every time you type "echo name" it should say "hello" yes?
if you want to display a variable you must put percentage (%) signs around it.
So therefore if you type "echo %test%" and it should say "hello" yes?
Step 2: Variables Step (2/3)
This creates a variable called "num" with a value of 1 attached to it.
(this means that we take "num" (aka 1) and make it num+1 (aka 1+1))
it should give us 2, right?
let's try it:
type the following in notepad and save as MathAttempt.bat
(do not include the stars (*))
it should say 2, yes?
it says 1+1
because the computer interprets your command as:
you: "so num=1, right?"
you: "so what is num plus one?"
pc: num+1 = 1+1
so the computer interprets your command literally.