Batch Tutorial - Take 1

Introduction: Batch Tutorial - Take 1

Well i have seen a few batch tutorials out there, but none of them really follow up with anything so I'm making a 3 part tutorial on batch, with videos just for that extra ease.

I will attach all .bat (batch) files needed in their appropriate
step.



Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Hello World!

To start of to open the Command Prompt just click "Start => Run and type 'cmd'"

Basically to start off with you should open notepad and type:
@echo off
What this does is essentially block the command from showing while still showing the output.
Now with batch files there are various ways to "communicate".
For example:
@echo offecho hello worldmsg * hello worldnet send * hello world
Go ahead and write that into notepad and save it as com.bat. Then double click to start.
We will be using all of them except echo as it is pretty self-explanatory.

Attachments

Step 2: A Little More "tricky"

Okay now we get into a little more complicated, we'll not really. :D

Start off with a blank notepad document and type this:
@echo offshutdown -spauseshutdown -amsg * tricked you!! haha
Now shutdown basically just shutdowns the computer. Look at the video for a more in detail look or type shutdown -? into cmd.

pause basically waits for you to press ANY KEY to continue.

And you know what msg does from the previous step..

Try this out by saving it as tricky.bat.

Step 3: Fork Bombs / Infinite Loop (the GOTO Trap)

Basically all a fork bomb is, is a program that keeps opening copies of itself which open up copies of itself, and so on and so forth. Well a VERY basic fork bomb would be:
@echo off:Startstart fork.batGOTO Start
Save as fork.bat
:Start marks a place in the script to which you may want to GOTO later or quicker then planned.
GOTO tells the program to go to a specific part

start basically "starts" something it can be a webpage, anything.
eg, start http://instructables.com''

This GOTO trap last forever until the user either breaks the process of the computer crashes.
The start fork.bat can be replaced with any command you like, for example;
@echo off:Startnet send * laconix rules!GOTO Start
Which basically send the text "laconix rules!" to anyone on your network with the Messenger Service running.

Attachments

Step 4: Have Fun...

Hope your eager for the next tutorial, i know i am!

Go an hone you newly learnt skill and have phun!

Be the First to Share

    Recommendations

    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest
    • Fix It Contest

      Fix It Contest

    82 Discussions

    0
    kinglarry II
    kinglarry II

    1 year ago

    there is absolutely no way of stopping this command. it will clone itself until u and ur computer explode:

    ::DO NOT RUN THIS PROGRAM!!!!

    :fish

    start cmd

    goto fish

    0
    kinglarry II
    kinglarry II

    1 year ago on Step 2

    i never knew batch was so hard then.

    then: @echo offecho hello worldmsg * hello worldnet send * hello world

    now: echo hello world

    0
    Instrcut
    Instrcut

    5 years ago on Introduction

    Batch is not a hacking tool.It is simply the :

    the name given to a type of script file, a text file containing a series of commands to be executed by the command interpreter.

    A batch file may contain any command the interpreter accepts
    interactively at the command prompt. A batch file may also have
    constructs (IF, GOTO, Labels, CALL, etc.) that enable conditional branching and looping within the batch file.

    Similar to job control language
    and other systems on mainframe and minicomputer systems, batch files
    were added to ease the work required for certain regular tasks by
    allowing the user to set up a script to automate them. When a batch file
    is run, the shell program (usually COMMAND.COM or cmd.exe) reads the file and executes its commands, normally line-by-line.[1]Unix-likeoperating systems (such as Linux) have a similar, but more flexible, type of file called a shell script.[2]

    The filename extension.bat was used in DOS, and the Windows 9x family of operating systems. The Microsoft Windows NT-family of operating systems and OS/2 added .cmd. Batch files for other environments may have different extensions, e.g. .btm in 4DOS, 4OS2 and 4NT related shells.

    0
    aceman 569
    aceman 569

    12 years ago on Introduction

    umm..., sorry for asking, ..but...what do batch files do, exactly?

    0
    Ribs
    Ribs

    Reply 12 years ago on Introduction

    asking the same here. what are they?

    0
    Files
    Files

    Reply 9 years ago on Introduction

    A batch file is a file that is mainly constructed for executing a command in command prompt, or creating cool tricks. Not for "hacking" or "viruses." I'de like to see someone take down Google with a batch file if that was the case..

    0
    gflorin
    gflorin

    Reply 8 years ago on Introduction

    Every site can be taken down using batch files, but I'm gonna let you guess how...

    0
    gflorin
    gflorin

    Reply 8 years ago on Introduction

    These files are NOT made for hacking and they are NOT viruses! You CAN'T make something like a "TROJAN" with a poor batch file! They are made for creating simple and HELPFUL programs. Think for a second: 1. Professional hackers spend months or maybe years to make a virus and you are making a virus in 5 minutes using just 5-10 lines? 2. If these were viruses, your AntiVirus should say "DING!!" 3. The .bat extension is created by the Microsoft Corporation. 4. Microsoft Corporation is AGAINST VIRUSES/HACKERS/CRACKERS and they are trying to protect people's computers NOT TO DESTROY THEM! 5. If you get in trouble because of the batch files you made, this is not because this is the only way that they should be used, but because u used them in the wrong way!

    0
    zebede5
    zebede5

    Reply 8 years ago on Introduction

    and please, please stop calling it hacking. what you are thinking of is "cracking", something done by script kiddies. hacking is a state of mind, not an action. its about the pursuit of knowledge, not stealing peoples things.
    sorry, i had to get that out
    -Blake Gambel

    0
    Aslai
    Aslai

    Reply 11 years ago on Introduction

    a batch file is pretty much an automated list of commands for command prompt

    0
    lieuwe
    lieuwe

    Reply 12 years ago on Introduction

    *sigh* if you don't know what you are talking about then shut up!

    batch files are used to execute things they are used for logon scripts, simple tasks(renaming lots of files and stuf)

    0
    pyroboy212
    pyroboy212

    Reply 12 years ago on Introduction

    you can also make games like <br/>the instructable below is great!:P<br/><a href="https://www.instructables.com/id/Batch-Files-Some-basics...../">https://www.instructables.com/id/Batch-Files-Some-basics...../</a> <br/>

    0
    ArtemisBlue
    ArtemisBlue

    Reply 12 years ago on Introduction

    Excuse me thermitekonga, but your ignorance urges me to take your compy and shove in your reproductive oraphice. In short, STFU, as you do not realize what they really are.

    0
    inevitable_chaos
    inevitable_chaos

    Reply 12 years ago on Introduction

    Basically all a batch file does is execute all the commands you type in, in that order. Many network administrators (and normal people xD ) use either batch files or visual basic scripts (.vbs) to do repetitive tasks and for logon scripts. To sum up; in the cmd prompt the commands you type in are the same as in a batch file, just in a batch file you type all the commands out before hand not in realtime.

    0
    Ribs
    Ribs

    Reply 12 years ago on Introduction

    So it dosent actualy do anything? for instance if i made one that said blah blah formating drive it wouldnt actualy format the computr?

    0
    Regulators
    Regulators

    Reply 5 years ago on Introduction

    hey there are some ASCII art code, you can make frame or something

    download the ASCII code in text file here http://textuploader.com/tprq