Intermediate Batch Command List

by Mr_ MikaS in Circuits > Software

2297 Views, 12 Favorites, 0 Comments

Intermediate Batch Command List

557b3d6e15be4dac6f00030b.jpeg
Mode con Lines ( Sets the height of the command prompt.)

Example: Sets the height of the command prompt to one-hundred.

Mode con Lines=100

Mode con Cols ( Sets the width of the command prompt.)

Example: Sets the command prompt to one-hundred an twenty.)

Mode con Cols=120

%Random% ( A random number is displayed when echoed.)

Example: Displays a random number such as 16454 or 68332, could be anything.)

Echo %random%

Lss ( Less than.)

Example: If 9 is less than 8 it displays "My life is a lie", but it's not so it won't display it.

If 9 lss 8 Echo My life is a lie

Gtr ( Greater than.)

Example: If 9 is greater than 8 it displays "Oh, good" and it is so it will display it.

If 9 Gtr 8 Echo Oh, good

Equ ( Equal to.)

Example: If 10 is equal to 5 + 5 it displays "Math" on the command prompt.

Set /a num=5 + 5
If 10 Equ %num% Echo Math

If Exist ( If a file exist on your computer.)
Example: If Google Chrome is on your computer it displays "Google" on the command prompt.

If Exist Chrome.exe Echo Google

If not Exist (Self explanatory.)
Example: If Google Chrome is not on tour computer it displays "Internet Explorer now?" on the command prompt.

If not Exist Chrome.exe Echo Internet explorer now?

>> ( Inputs things into a file.)

Example: Makes a text document called "Hello" on your computer and writes "Hello" in it with out displaying "Echo"

Echo Hello >> Hello.txt

>> nul ( Inputs stuff into nothing.)

Example: Pauses the Batch file until a key is pressed but does not display anything and does not make a file.

Pause >> nul

Call ( Outputs stuff on to the command prompt.)
Example: Say you have a batch file called "Greeting.bat" and it has the command "Echo Hello" in it. This takes that command and uses it on the batch file you were using at the time and displays "Hello"

Call Greeting.bat

Timeout /t ( Makes a delay.)

Example: Delays the Batch file for five seconds or until you press a key and displays: "Waiting for 5 seconds, press a key to continue ..."

Timeout /t 5

/Nobreak ( Doesn't let you press a key to continue.)
Example: Delays the Batch file five seconds, does not skip the delay when you press a key, and displays "Waiting for f seconds, press CTRL+C to quit ...". If you press Ctrl C the Batch file will close.

Timeout /t 5 /Nobreak

Tree ( Displays tree graph of all the files on your computer.)

Example: Yeah, look above this there's an explanation.

Tree