Batch Basic Tutorial/Reference 02-05-2013, 04:13 AM
#1
Batch, although many people think is "nooby and useless" has many, MANY uses, for windows of course.
Lets start off with some basic commands.
@echo off : This command is not essential, it only makes the appearance of your batch program look neater, by turning off all the pretext that is inside of batch programs.
pause : This sets a pause in the program, prompting the user to press any key to continue.
cls : cls clears all the text on the screen.
exit : This, obviously, exits the program.
echo : this "echos" the text you put after the command. For example: "echo Hello World!" prints Hello World! on the screen.
color : This sets the color of the text. The colors are defined below:
0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White
" " : Quotation marks open the process set inside the quotation marks. For example:
"www.google.com" Will open Google.com.
Finally, at the end of coding a program, click file > save as > any_name.bat.
Now lets smash up all of these commands into one program.
@echo off
color a
echo This is my first program!
pause
cls
echo I hope you enjoy it!
pause
cls
echo Now here is a great forum you should try out!
pause
cls
"www.anarchyforums.net"
pause
cls
echo Thats it for now!
pause
exit
I hope you enjoyed the tutorial!
Let me know if you want another Batch tutorial.
Lets start off with some basic commands.
@echo off : This command is not essential, it only makes the appearance of your batch program look neater, by turning off all the pretext that is inside of batch programs.
pause : This sets a pause in the program, prompting the user to press any key to continue.
cls : cls clears all the text on the screen.
exit : This, obviously, exits the program.
echo : this "echos" the text you put after the command. For example: "echo Hello World!" prints Hello World! on the screen.
color : This sets the color of the text. The colors are defined below:
0 = Black 8 = Gray
1 = Blue 9 = Light Blue
2 = Green A = Light Green
3 = Aqua B = Light Aqua
4 = Red C = Light Red
5 = Purple D = Light Purple
6 = Yellow E = Light Yellow
7 = White F = Bright White
" " : Quotation marks open the process set inside the quotation marks. For example:
"www.google.com" Will open Google.com.
Finally, at the end of coding a program, click file > save as > any_name.bat.
Now lets smash up all of these commands into one program.
@echo off
color a
echo This is my first program!
pause
cls
echo I hope you enjoy it!
pause
cls
echo Now here is a great forum you should try out!
pause
cls
"www.anarchyforums.net"
pause
cls
echo Thats it for now!
pause
exit
I hope you enjoyed the tutorial!
Let me know if you want another Batch tutorial.