Special Commands in Batch

by ItzMynow in Circuits > Computers

824 Views, 11 Favorites, 0 Comments

Special Commands in Batch

15, 7:49 AM.jpg
These commands you will eventually have to use in making a batch file/game.

Color

In batch you can write color (number). Basically you can do any color, check this link for colors http://www.robvanderwoude.com/ntcolor.php I did not make this website.

EXAMPLE

@echo off
TITLE Game

:new
Color 5a


The color would be Purple and Light Green

Cls/Clear Screen

Cls is a command that Clears Your Screen of code, i usually use it after i make a new category.

EXAMPLE:

:new
Cls
Echo.
Echo Hello World
Echo.

Input Commands

To use input commands start by making a way in your code to select.

EXAMPLE:

: Menu
Echo.
Echo hello world
Echo.
Echo 1) Continue
Echo 2) Exit
Echo.
Set /p c=Enter

If %c% == "1" goto Game
If %c% == "2" goto Exit

What this does is if the user of the command types 1 he/she will go to the Game, if he/she types 2 he/she will go to the exit screen.

C means input basically. So the last 2 lines of code mean If input equals 1 go to game.

Leq and Geq

Leq means "Less or Equal To". Geq means "Greater or Equal To". These two words of command can help create shops for games, or making enemies stronger.

EXAMPLE:

:Shop
Cls
Echo.
Echo 1) Machete 5$
Echo.
Set /p c=Enter:

If %c% == "1" goto machete

:Machete
Cls
If %money% geq 5 set Dmg +=5 (
Goto Shop
)
If %money% leq 4 goto NotEnoughMoney