Introduction: Basic Batch Command List

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
Cls
Echo Bye

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

Example:

Echo Hello world
Pause
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
pause
cls
Echo Bye
pause
exit

: (A series of code title)

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

:Start
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
Pause
Cls
Echo Bye
Pause
exit

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 "https://www.instructables.com/"

Comments

author
Mr_ MikaS (author)2016-02-06

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

author
sammy_NAULaaa (author)2015-12-16

Do you have more codes

author
Mr_ MikaS made it! (author)sammy_NAULaaa2015-12-16

If you mean batch file codes, yes I am working on some new codes. If you mean coding languages, yes I'm learning C#. If you mean Batch commands, temporarily no I don't know any more commands at the time.

FMWPHFTICICQMCZ.jpegphoto.png
author
sammy_NAULaaa (author)Mr_ MikaS2015-12-18

can you send me the coding languages

author
Mr_ MikaS made it! (author)sammy_NAULaaa2015-12-18

Well, I can send you the coding language links, but C# needs a coding compiler to run unlike batch file coding. The only other languages I know that don't use a coding compiler is VBScripting. If you want a command list on that, I'll work on it.

This is C# : https://en.wikipedia.org/wiki/C_Sharp_(programming_language)

This is the best coding compiler : https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx

FMWPHFTICICQMCZ.jpegphoto.png
author
sammy_NAULaaa (author)Mr_ MikaS2015-12-19

thanks a lot man

author
NicoFilippo (author)2016-05-12

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...

author
mohab.mohamed.9404 (author)2016-01-08

why this code doesn't work

set /p name = write site name

start www.%name%.com

author

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

author

Try using @start instead of start.

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

About This Instructable

2,077views

21favorites

Bio: 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 ... More »
More by Mr_ MikaS:Argario server listHow to make an Agario server (with command list)Pet wars
Add instructable to: