Friday, October 28, 2011

Batch Basics

Batch is a very basic programming language
To save something as a batch end it in .bat
@echo off
-put at the start to stop all srts of stuff popping up
echo [word]
-says something

pause
-stops the batch
-put at the end of a batch

goto [menu]
-goto's a menu

:[word]
-sets a menu

set /p [variable]=
if %[variable]%==[word/number] [action]
eg
set /p var=How are you? 
if %va%r==good goto good
if %var%==bad echo oh dear
if not defined var goto menu
-very useful

cls
-clears screen

title [word]
-sets title

color [color code]
-set color of texr
0a-green
0b-blue
0c-red
0d-purple
0e-yellow
0f-white
00-black
-can be reversed for background
eg.
CA-red background, green text

some other things that are fun
%random%-displays a number
echo %[variation]%-says the variation


whats this, its a batch calculator
save as calc.bat
http://adf.ly/3S003

No comments:

Post a Comment