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.
Remove these ads by
Signing UpStep 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;
SET name=value
Type the following into your CMD:
SET name=hello
'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?
NO
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?
YES





































Visit Our Store »
Go Pro Today »




i used the if %random%==1227 goto begin
SET /a Var=%RANDOM% %%max + min
That method uses modulo expressions to constrain the number.
Example:
If "max" had the value of 10, and "min" had the value of 1...
The variable "Var" would be a number between 1 and 10.
so far I hav
@echo off
echo welcome to brian
echo brian will now add 4 1698 times
set/a num=4
:furt
set/a num=%num%+4
echo %num%
if %num%==6792 goto :end
goto :furt
:end
echo you have reached 6792
echo continue?
set v1=goto :count1
set v2=goto :g
echo press 1 to continue
echo press 2 to stop
set/a nu=6792
set/a n=0
set /p you=
if %you%==1 echo %v1%
if %you%==2 echo %v2%
@echo off
echo welcome to brian
echo brian will now add 4 1698 times
set /a num=4
:furt
set /a num=%num%+4
echo %num%
if %num%==g792 goto end
goto furt
:end
echo You have reached 6792
echo continue?
echo press 1 to countinue
echo press 2 to stop
set /a nu=6792
set /a n=0
set /p you=
if %you%==1 goto count1
if %you%==2 goto g
if %you%==1 %v1%
if %you%==2 %v2%
Is this your first computer?
-Cheers, Chris