Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Batch and MS-Dos


Batch and MS-Dos

By ghostghost | 5853 Reads |
0     0

Welcome to my batch tutorial,

DISCLAIMER: this article has nothing to do with me or hellboundhackers.org and its partners. use this information at your own risk. we can not be held liable for what happens to you.

to start open up notepad(its in accessories) now on you blank docu<i></i>ment type

@echo off cls

@echo off- hides code so no one can see your commands

cls(clear last sentence)- clears all data above it

now the most basic command is echo. echo allows you to type stuff in the command prompt(all batch files show up here).after any sentence you need to put pause(unless your dont need to).exit is the command to exit the command prompt

example: @echo off cls echo wow i feel smart! pause exit

SAVING: now u have created your first batch file.create a folder on the desktop for your batch files.now go to file>save as, once you are here save your batch file as (name of your file).bat (if dot bat is not at the end the file will not work).save it in the folder you created and your done.open up the folder and double click the file.the command prompt should now open up and say

wow i feel smart! press any key to contine…

once you press a key the command prompt should exit out.

now that you know the basic echo cammand here are some more.

LOOPING: to loop something or make it reapeat do this

:loop echo I AM ANNOYING!!! goto loop

this will make I AM ANNOYING!!! fill the screen over and over until you x out of the page. also note that loop can be anything like a number or letter, so you could also write this as

:a echo i am annoying!!! goto a

this would have the same affect as the one with loop would.

COLOR: adding color to your wonderful batch programs!!!

just type color then the background color number or letter then the font color number or letter.

exmaple:

color 0b

this will make the background black and the font light aqua.here is a list of colors to choose from and their number/letter for the code.

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 Like Yellow 7 White F Bright White

to make a sentence change color just loop the colors under the sentence.

example:

Echo MANY COLORS!!! :c color 01 color 10 goto c

this would make the screen say MANY COLORS!!! while the font and background go back and forth between black and blue.

START: this command is used to start programs or open up the internet. hres an example

start www.hellboundhackers.org (this would open up hellboundhackers.org in the internet)

start c:(any file) (this would open up the file you specified)

start start start (this would open up command peompts)

MENUS: creating a menus is just looping maney things. example:

title MENU :menu echo to see a smiley face enter 1 echo to see a sads face enter 2 echo to leave enter 3 set /p choice=enter what you would like to do: if %choice% equ 1 goto smi if %choice% equ 2 goto sad if %choice% equ 3 goto lev

:smi echo 8D pause goto menu

:sad echo 8( pause goto menu

:lev exit

theres a sample menu. please note that choice can also be anything u want as long as it is one word or two words with an underscore(this_is_an_underscored_sentence)

look for more articles from me soon, all will involve batch and probably doing some stuff that will get u in some s*** if you try it at school. Anyway, see yall later.

CF out…

Comments
Flaming_figures's avatar
Flaming_figures 18 years ago

You left out what set /p means, and how to work with it (like, yours, set /p choice=enter what you would like to do: But you dont explain what it is) otherwise it's clear and basic. Good article.

ghost's avatar
ghost 18 years ago

Great article, kept me reading all the way through ^_^

ghost's avatar
ghost 18 years ago

Same here :) I didn't know about the set command, so I've learnt something new today… now I've made an cool itee menu thing :P

ghost's avatar
ghost 18 years ago

Nice tut - same about leaving out what /p means, but I can always google it. Also - maybe include something on how to send .bat to a remote computer and open it there (AUTOEXEC.bat ??) Nice stuff! Peace

ghost's avatar
ghost 16 years ago

Wow man thank you so much