How to Batch for Starters

Introduction: How to Batch for Starters

That is an image of one of the simplest forms of coding there is. Batch. Not too many people know about it, but it (in my opinion) is the best coding language there is. It's about as simple as a DOS interface, and quite similar, too. When you wanted to delete a file in DOS, you would type in something along the lines of:

Delete UnwantedFile.PNG

And it would be gone. The interface then was just a blank screen to type instructions like this into. Today, computers do the same thing, but they've been pre-programmed to interpret dragging a file over the icon for your "Recycling Bin" as the delete command. Underneath the fancy graphics, Batch is at work, operating the computer.

Step 1: Batch Codes

Above is the code that created the batch file. just save it as a .bat, and you have a batch file! Don't code batch in Microsoft Word, it doesn't work. But Notepad, a standard Windows software, does.

1. All files need to start with a line saying @echo off. Try it without to see why.

2. Color changes the text from grey on black to something more exciting. Look up "Batch File Colors" to find codes like 0A (my personal favourite).

3. Mode 1000 makes the window go full screen.

4. Title sets the title of the page. Title Blabaloosh, and that's the name of your page when opened.

5. Goto commands are a bit more complicated. It would make the code go to the matching colon. Example:

@echo off

goto Blabaloosh



the code went from Goto to Blabaloosh, and skipped Destroying the world (Not a real batch command).

6. Echo makes the following text appear.

7. %random% acts as a random number between 1 and 32016. Don't ask me why 32016.

8. Set, Set/a, and Set/p are all complicated commands.

Set Variable=20

Echo %Variable%

It would read out a text saying 20.

Set/p Text=What's your Name?

Would allow the user to type something, which would then become the variable "Text". What's your name? would come before the space to type.

Set/a Num=1+1

This would make %Num% be 2. Basically, use this for equations.

9. Choice is easily the most complicated Batch code I know. Well, no, but it's the most complicated Batch code you're ready for. Pay close attention to this. If you're confused, ask me in the comments.

Choice /c PE /n

if %errorlevel% == 1 (

goto Play


if %errorlevel% == 2 (



P and E are the keys you would press in this instance. Since P is the first listed, pressing P would be

"errorlevel 1". Pressing E is %errorlevel 2%. EXIT is a command I have not yet taught you- I will now.

10. EXIT closes/ends the program.

11. Pause will wait until a key is pressed.

12. Timeout will wait a certain amount of seconds, maximum 1000. Example:

Timeout /T 1

Will wait 1 second.

Timeout /T 1 >NUL

Will wait 1 second, and display no text because of it. you can use >NUL on any code.

One last thing: if a batch script reaches a point of no text, it will end. this can be circumvented by Goto. good luck!

Be the First to Share


    • Mason Jar Speed Challenge

      Mason Jar Speed Challenge
    • Bikes Challenge

      Bikes Challenge
    • Remix Contest

      Remix Contest

    7 Discussions


    4 years ago

    So,here we go "back" to the good old DOS. But keep in mind that "even DOS", (and them all other lang. c, c+, c++, fortran, pascal etc.), are "high lewel" languages that are "upgraded " from assambler. When they mocrocontrollers came I had no choice but to use a specific assambler for just "that" processor, there were no universal code to match with others (there were no others). The first "microcontrol" I got on to was 1bit data, (read: one bit data and sixteen adresses... yes, sixteen).


    Reply 4 years ago

    Neat. I'm constantly trying to learn more coding languages, and I'm really interested in the old ones. I would love to hear more about it.


    Reply 4 years ago

    HI! I would gladly share my experiences in elektronics, (been there since ~ mid 70's, them first course's with TTL-logics for me). Please contact me e-mail:
    or go to my site to get a glance of my something.
    I attach a couple of pictures of the assambler prog. (the language used here is "mostly" Finish :)))


    4 years ago

    Thats great do you have any suggestions where i can get more good explaination of the functions of other methods and operators?


    Reply 4 years ago

    Searching up batch codes online is a good way to learn new commands. The way you combine them to code is more something you develop yourself. I personally learned Batch by going online after seeing a tutorial on making a Matrix Code (Lots of numbers on a screen) and got really into it. There are a lot of places where you can learn batch.

    Good Luck!


    Reply 4 years ago