Basic Batch Command List


Introduction: Basic Batch Command List

About: I'm kid that bumped into batch file coding and made lots of effort to learn every thing to make text based games, at least until someone told me that there is more than Batch, then I tried to learn C++, but ...

Echo off (Stops displaying c:> before every line of code displayed in the command prompt.)

Example:Stops displaying c:>

Echo off

Echo (Displays a message on the command prompt.)

Example: Displays "Hello world".

Echo Hello world!

Title (Sets the the command prompt title.)

Example: The title is now "Greeting the world".

Title Greeting the world

Cls (Clears all text above and does not display Cls)

Example: Displays "Hello world" then Displays "Bye" With nothing above Bye.)

Echo Hello world
Echo Bye

Pause (Pauses the code until a key on the keyboard is pressed and displays " Press any key to continue...".


Echo Hello world
echo Bye

Color (Sets the color of the text and background. The first digit is the background the second digit is the text.)

Example: 0 is the background A is the text.

Color 0A

Set (Sets a variable.)

Example: "Name" now equals "Bob".

 Set Name=Bob

If (Condition for a variable.)

Example: If the variable "Name" is equal to Bob then it will display "Welcome, Bob" on the command prompt.

If %name%==Bob Echo Welcome, Bob

If not (Condition for a variable.)

Example: If the variable "Name" is NOT equal to Bob then it will display "Your not Bob" on the command prompt.

If not %Name%==Bob echo Your not Bob

Exit (Closes the command prompt)

Example: Closes the command prompt after the pause.

Echo Hello world
Echo Bye

: (A series of code title)

Example: The class is called "Start" and executes all the commands below it.

Echo off
Title Are you Bob?
Color 0A
Set Name=Bob
If %Name%==Bob echo Welcome, Bob
If not %Name%==Bob echo Your not Bob
Echo Bye

Set /a (Sets a variable with a math equation.)

Example: The variable "Number" equals 2.

Set /a Number=1 + 1

Set /p (Asks for user input.)

Example: Displays "What is your name:" and the variable "Name" set to equal whatever you type into the command prompt.)

Set /p Name=What is your name:

Start (Will open a program on your computer or open a Link)

Example 1: Opens up Google Chrome the program.

Start Chrome.exe

Example 2: Opens the link to instructables the web site you are on right NOW.

Start ""

2 People Made This Project!


  • Woodworking Contest

    Woodworking Contest
  • Clocks Contest

    Clocks Contest
  • Planter Challenge

    Planter Challenge

We have a be nice policy.
Please be positive and constructive.




I'm sorry, I don't see any space.

How can I make a BATCH program solve a math problem with preset formula?

For Example: You enter 3 and using formula S=3,1*d (*= times, d=the set number, so in this example 3) and you get the result? Please, help urgent...

Remove the space between the name and the = in the first line

Try using @start instead of start.

@start allows there to be %variables% in it.