Instructables
Picture of Very Basic Batch Tutorial
If you already know the essentials of Batch the you DO NOT need to read this instructable continue to Not So Basic Batch Tutorial.

NOTE!: Whenever something is in quotation marks ("example"), do not include the quotation marks (if you see that you must just type: example)
 
Remove these adsRemove these ads by Signing Up

Step 1: So, what is Batch

For those who don't know, a Batch file is a text file containing a series of commands to be executed by Command Prompt (CMD). When a batch file is run, CMD reads the file and executes its commands.

To open your CMD, click START > RUN > type "CMD" > OK
(some of you may need to type "CMD.EXE")
(or you can click START > ALL PROGRAMS > ACCESSORIES > COMMAND PROMPT).

Step 2: Now what?

These are some VERY basic commands you need to know:
(please try out some of these commands in your CMD).

@echo off - This gets rid of that "c:\documents...etc"

echo - This displays a message, (e.g "echo hello" = "hello") because if you type "hello" into CMD it will interpret "hello" as the command

cls - Clears the CMD of all text.

color - Changes the color (type "help color" for a list of colors).

goto - Goes to a particular word in your text (you will learn more later)

pause - Pauses the command prompt and displays the message: "Press any key to continue..."

and there are a few more we will learn about later.
admin6 years ago
Hello, and welcome to the Instructables community! It's great that you've decided to tell the world about something you've made by publishing an Instructable. We just wanted to let you know that your project still needs a little more work if you want it to be well received on Instructables. Projects that don't include certain basic elements tend not to get the attention that they deserve, and so we'd love for you to check out the list below of what makes a successful Instructable. Successful projects on Instructables include: - clearly written details of a finished project with instruction - as many steps as are necessary to explain your project - clear images that you took of your project for most, if not all of your steps - an intro image - proper spelling and grammar - appropriate cautions or safety considerations I'll give you another opportunity to make any final changes to your project before we publish it. Once you're all set to go, please republish your project and send me a quick comment letting me know that you've made some changes. I'll give it a quick final check to make sure you're on the right path, and then remove this note. Thanks for your submission and we hope to see your project published soon!
tabascow3 years ago
@ echo off
echo :press a key to go to ???
pause
start www.instructables.com

Remove the second line as pause will already say press any key to go.

himanshu166 months ago

that's give big help

Regulators8 months ago

this is cool, but i made my own batch file, that allow you to download file from internet, just like download manager. please visit this instructables

http://www.instructables.com/id/How-To-download-File-on-internet-using-batch-file/

thanks dude!

will4214 years ago
I learn my first batch stuff here and and looky me! I understand every command from TAT`s batch... file... mega... subsystem I think? Or is it just system? OH WELL!
sinxxx4 years ago
ee
Mr. Qwack5 years ago
u dont need the @ in front of the echo if u type in echo off or echo on
 You do if you want a clean file. What I mean is that the command turning echo off will show up at the top. You don't want one code to show up and then have it be all clean, you either put the @ and make it all clean or forget that command and deal with the extra stuff.
redmaker5 years ago
coooooool i put color 4d
You like pink when your username is redmaker!??!?!??!?!??!??!
will421 will4215 years ago
Okay that is kinda cool....
haha
no i hate pink but i didnt knolw wat to put so i radomly pressed 2 keys
bmlbytes5 years ago
Ahh! The evil GOTO command!!!!!!!!!!!!!!!!!!!!! Make it go away! Try using this in school for a real programming language. The professor will tell you to just leave and never come back. GOTO is evil in all cases.
FORK BOMB FTW!!!!
Indeed
 It doesn't seem to work for m, I made a batch subsystem which is incomplete and it does not seem to work wah...

Sejma (author)  bmlbytes5 years ago
HAHAHAHA!!! so true friend, im busy studying java atm and whenever the topic of the GOTO command is brought up, our proffesser pretends he's deaf :D
Haha, yes indeed. I had ICT class last week(to orientate for next year's electives)
and i wrote a simple program including multiple choice questions and a simple clock ( commands: echo %TIME% %DATE%) and the teacher was like: uhm, if you're gonna use GOTO in my class you can just leave and i'll give you an A because, it IS pretty advanced but still it's not good. haha GOTO = evil!
I'm sorry, but if the commands clear the line, type in the time, and wait half a second each time, use the goto command, as it is the way to do it. Loops take too much time.
Then your professor should not be teaching programming. The goto command must not be over-used, but it stops your programs from being linear. That is very useful, as your professor doesn't realize.
erikals5 years ago
(removed by author or community request)
erikals erikals5 years ago
EDIT: I found the file, downloaded it, and it works.
comno5 years ago
Can you do this with programs or documents
comno5 years ago
Thank you much
Beverly58765 years ago
Batch is a new language for me. I'm still not sure what all it is or how far I'll get with it but, I do love a challenge and learning something new. In fact...I always did want to learn a new language. LOL Thanks.
Eirinn5 years ago
Thank you, just what i needed for some basic shortcut stuff!
Great!!
Sejma (author)  HardCoreHacker6 years ago
ty man
altondoug6 years ago
I've been programming for a few years and I think its very informative for the newbies . Most of us won't take the time to explain the little stuff that we take for granted knowing..
Sejma (author)  altondoug6 years ago
NMice to hear some positive feedback, thanks :)