Login Register






Batch tutorial for noobs Vol. 1 (we all start somewhere) filter_list
Author
Message
Batch tutorial for noobs Vol. 1 (we all start somewhere) #1
For a new coder, batch is a great place to start. It's fairly easy to understand, quite forgiving with mistakes, and it can do anything except make a burrito (trust me, I tried). Here, I'm going to go over as many aspects of batch as I can. So let's get started!

Code:
@echo off echo
These two commands aren't mandatory but they make the file look much cleaner.

@echo off SHOULD be at the start of all your batch files. It will hide any unnecessary info in the program.
echo is used when you want to display text.

Code:
color
Color will determine the color of the text as well as the background. The first of the two characters controls the background and the second controls the text color. The link for a table will be (HERE).

Code:
cls
Actually quite vital. It's used to clear the screen of any text or previous input. Good to use after a password input.

Code:
set /p (put in 2+ letters) if %(same 2+ letters as above)%==(type a key here) (put any command here)
This is a tad advanced but very useful. It is a small combination used for a conformation or a password. Example below.
Code:
@echo off color 02 echo Input Password Now set /p pass if %pass%==poop goto a goto b :a cls echo hi pause :b echo wrong password pause
This will ask for a password and if it is correct, it will say hi.
if it is wrong it will tell you so and close the program.

Code:
cd
changes or shows the user's current directory. Can be used to rape a computer.

Code:
format shutdown restart logoff start copy
These all do exactly what they sound like. For conformation, start runs a file or program.

Code:
tskill
kills a task. Completely. Not just the window.

Code:
time
Sets the computer's time.

Code:
del
deletes a file or folder. Bypasses recycle bin/trash.

Code:
*.*
looks kinda like a harmless face right? Wrong. This is one of the most dangerous Things you can put in a batch code.

Code:
C:\
The computer OS. Everything is there.

Well, this was volume 1 of my batch tutorials. Hope you all enjoyed!
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.

Reply