In this 'step by step' tutorial I will be showing you Simple Batch Programming. Once you have completed this step by step tutorial you may find batch programming as easy as pie (not the mathematical pie)

I will show you three different batch programs. One will be a load of random numbers, another will be how to make the program say stuff and last one how to type to the computer. (sorry if you know all this but i cant use the if command its complicated if you want to find out more type 'if /?')     

Step 1: Step One All the Different Colours You Can Use in Batch Programing.

You must have notepad to do this and you have to start with the following command:
@echo off

Since you can't read the pic you have to have a number then a letter for your different colours the number is the back ground and the letter is the writing. here are the numbers and letter:

Right first when your batch programing you have to write 'color' then one of the following numer and letter:

0= black      a= green
1= blue        b= apua
2= green     c= red
3= apua      d= purple
4= red          e= yellow
5= purple     f= bright white
6= yellow
7= white
8= gray 
9= light blue

Step 2: Batch Program 1 Matrix Program

I have enlarged the image so you may be able to see it. if you have seen 'The Matrix' you will see lots of different green numbers appear.

The ':start' is a label so the 'goto start' will go back to that label and replay whats after it in this case in a loop never ending (unless you close it)

The echo command will project what is after is on the same line but in the notepad style is says %random% that is the random number so in batch programming that is a random number.

As you can see the colour is a black back ground and green writing. 

In the second picture you can see how to save a batch program

1. once you have done the coding press save as...
2. name what you want to call it in this case Matrix Program (my one says different) but once you have named it you MUST put .bat at the last word of the title so it would be Matrix Program.bat
3. You MUST select save as type to all files like in the picture then you can press save.

Step 3: Batch Program 2 Deleting..

in this one its just like the matrix program apart from in stead of:
echo %random% etc.
this time it will be:
echo  Deleting... %userprofile%\documents\%random%
echo  Deleting... %userprofile%\documents\%random%\%random%

The %userprofile% is it will come up as c:\(name of your comuter)\
and this time the color is black background and red writing.

Its the same to save it just like the matrix program but you might save this as:

Step 4: The Last Batch Program Story Writing.

This one is more advanced than the others so try stay on track.

the same with the start as the matrix program but the 'SET /p userin1' is the command were you can type.
the userin is like a random or userprofile (This is a variable) when you want it echoed put echo %userin1% you still with me?
then the pause>null is a pause you can put pause but it will say 'press any key to continue...'  with this one it will go blank and once you press any key it will end.

Step 5: DONE!

now you are done with the 3 batch programs comment if you like or not and if you found it complicated or if you found it easy.

Also post if you have learned the commands and sent me some of your own batch programs.

THANKS for viewing Io kieran oI out :)

<p>first of all thanks for the tutorial....i have a request could u plz share all the commands of cmd along with the description and the syntax then it would really be of great help to me.....thanks in advance</p>
<p>Is there anyway that I can make a interactive story with this file?</p>
<p>I know how to do that in python. use a if elif else algorithm</p>
<p>Oh yeah! There is! But not with &quot;this&quot; file in particular, Batch purpose you lots of things. But idk how do if can understand words with spaces. It'd be great if someone told us! Also, I made graphical games (with images), thanks external commands. So yep, you can make an interactive story as you could... Make a platform games, etc.</p>
<p>You can make an interactive story with batch (and I assume by 'interactive' you mean the choices the user makes affects the direction of the story) using simple input commands to use variables to take you to different labels. I'm not very experienced with batch myself but I've done it for a while now and it's very easy to use, all you really need to know how to do is to set the values of variables and be able to recall them later, which even I can do and relatively easy in my opinion.</p>
A batch program run in start up but they work after 5 day at my time..like sunday ,saptember 5th at 7Pm ..<br><br>How to make this program
All of you .. Any idea to help me
<p>I yet Dont Get You.... :/</p><p>The Matrix Program Whats That</p><p>Can you please make me learn each and every command of batch and it's description like what does it do please i really need to learn it!</p>
<p>Sorry for the late reply... well very late reply, and its been a while since I made this and have done any form of batch file coding so I may not be 100% correct on this but the matrix program just randomly generated a sequence of number and prints them on the screen in an infinite loop giving the effect of the random characters in the film the matrix. However in the film it is actually random ascii characters this is just numbers. The echo command is what will be printed after it. For instance if you put echo Hello World it will display Hello World in the console. The %random% is a built in variable that will generate a random number. I believe its 4 digits but I cant remember. The :start is called a label. This is like your function. This create a place which you can link back to using the goto command. so in this case this is an infinite loop as it will keep on going back to the start label and displaying the random numbers. Hope this helped and again sorry for the year late reply, been a but inactive.</p>
<p>u might wanna tell us what EXACTLY this batch will do when clicked on... it deletes stuff i guess.. but what? random things?</p>
<p>i clicked it to see what would happen and it looked cool but i closed it as fast as possible because i thought it was wiping my stuff xD was it? </p>
<p>nvm figured it out :p doesnt delete anything just says it does :p</p>
<p>This is great!!!</p>
<p>hi this is something nice, can you tell me how to compile code ,, I am a newbie and learning these things </p>
<p>Wow 55,000 views! Thanks guys considering that i made this when i was 11 means a great deal to me. This makes me feel like a right geek helping others in batch file who are probably older than me it's just mind blowing. Cheers guys. Remember if something doesn't work please post your issue and your code if possible. :)</p>
<p>this is cool code, but i made my own batch file to download file from internet</p><p>please visit this instructables <a href="https://www.instructables.com/id/How-To-download-File-on-internet-using-batch-file/" rel="nofollow">https://www.instructables.com/id/How-To-download-Fi...</a> </p><p>thanks dude!</p>
<p>done! looks good!</p>
<p>jack says hi</p>
thanks for the help ..but i want to know that ,,how to compile and execute a batch code
what as a exe then cant help but if u meen to just run it then just click on it where you have saved it. If you just want a code executed then go into command prompt and type in the code but if the code requires variables then you'll have assigned the variables.
wow 10000 views thanks guys i'm glad that you're looking at my instructables and hopefully using them to make your own better program. Once again thanks realy apreiciated
Hey guys I've been taking up java (i don't know that much and i probably wont be explaining what does what as well as i may have done in by batch tutorials) would you guys want be to start making some java tutorials. Thanks Io Kieran oI
me* (not be)
Not a bad ible. I used this to create a batch file for compiling .love files (from a 2d lua game dev engine called LOVE) into .exe files. very good job!
Hey man XD... i really appreciate all these codes XDD... But i have one certain problem. Right now i have this code: <br> <br>@echo on <br>:Top <br>color 02 <br>prompt Hi, You Have Been SCAMMED XD <br>start color 0c <br>pause <br>prompt Hi, You Have Been SCAMMED XD <br>prompt Hi, You Have Been SCAMMED XD <br>prompt Hi, You Have Been SCAMMED XD <br>prompt Hi, You Have Been SCAMMED XD <br>prompt Hi, You Have Been SCAMMED XD <br>prompt Hi, You Have Been SCAMMED XD <br>prompt Hi, You Have Been SCAMMED XD <br>%0 <br>rem --------------------------------- <br>rem Self Destruct <br>del /f /q %0 <br>rem --------------------------------- <br>goto top <br>%0 <br> <br>(the pause is so to not destroy my computer whilst modding it XD) <br>... <br>My idea for this, is to open command prompt (pretend to be deleting stuff...), then open up another 8 command prompts (make them look like the one before, scrolling and pretend to delete stuff) and repeat the process....then to delete itself. <br> <br>BUT I HAVE NO IDEA D8&lt; <br> <br>ANY SUGGESTIONS WOULD BE APPRECIATED XDD <br>
Just a wuick tip, instead of using the &quot;prompt&quot; command you could also use the &quot;echo&quot; command. The only difference is that if you want just the message you will need to put in &quot;@echo off&quot; at the start of your script: <br> <br>@echo off <br>echo Hello <br>echo You have been hacked <br>etc <br> <br>Also, I don't know what you attempted to acheive with the over-use of the &quot;rem&quot; command.
thats what i used in my codeing too. but thanks for the tip :)
i have done something like that before it can open anything what you do is this one will keep on opening notepad and won't stop: <br> <br>@echo off <br>color 0a <br>:start <br>start notepad.exe <br>goto start
also you can use the erase function but you have to know the file name and the file type
thanx man... really appreciate it XD <br>i have recently just developed this code <br> <br>@echo off <br>:begin <br> <br>start dir <br>color 01 <br>dir <br>start dir <br>color 02 <br>dir <br>start dir <br>color 02 <br>dir <br>start dir <br>color 03 <br>dir <br>start dir <br>color 04 <br>dir <br>start dir <br>color 05 <br>dir <br>start dir <br>color 06 <br>dir <br>pause <br>%0 <br>goto begin <br> <br>Its 50% of what i want, and 50% not.. XDD <br>... <br>oh now that is weird....so with cmd you can spam internet &gt;&gt; XDD <br> <br>hehe... thanx man, and soz for late reply... computer was in cause hard drive broke down... .hehe seems like code killed my computer XD
thats the bad thing when making things like that its a risk to use it on your nown computer i dont it once but i knew how to stop it
:L yeah thats true ... <br> <br>though it still is fun spamming the computer XD
Y don't you post some instructables of what batch programs you've made? and if some of e'm are like my ones i dont realy care but you could put my name down if you like but give it a show XD
shot* <br>
Hey everyone thanks for viewing but i made a more complex version if this is too simple for you heres the link: <br> <br>https://www.instructables.com/id/More-Complex-Batch-Programming/
also can you guys send me some of your own programs I would really like to know what you guys have been making. Email: <br> <br>kierancoppins@yahoo.co.uk <br> <br>P.S Please no friend requests or spam thanks. <br> <br>Io kieran oI out ;)
Hey Io kieran oI,<br>actualy, for the color command, it can be two letters, two numbers or a number and a letter. The first character is the background and the second number is the text ;)<br><br>And thanks for putting my tutorial in your comments, realy apriciate it<br><br>sincierly,<br>country boy 97
np :)<br>
Hay guys the batch program I mad called 'Matrix Program' i found a better one lots of coding but he tells you it. Just copy and paste it. Its better than my one with my one there are lots of different numbers. But with his its just 0s and 1s. here is the link: https://www.instructables.com/id/BATCH-bat-Matrix-original-/<br>

About This Instructable



More by Io kieran oI:More Complex Batch Programming How to password protect a folder on your computer Mod of Alien Terminator's Oodammo Assault Rifle 
Add instructable to: