Welcome to PlagueFest.com! Log in or Sign up to interact with the Plague Fest community.
  1. Welcome Guest! to interact with the community and gain access to all the site's features.

Tutorial to batch

Discussion in Tutorials started by Anathema, Feb 5, 2012

  1. Feb 18, 2011
    Well the Pats lost so in anger here is a tutorial.

    For those who don't know, a Batch file is a text file containing a series of commands to be executed by Command Prompt (CMD). When a batch file is run, CMD reads the file and executes its commands.

    You are thinking what de fuq do I care? Batch can help you remove malware by killing malicious processes, helping you get to hidden directories where malware is hiding and it can help you optimize your computer when you want to stop certain processes when you are playing a game.

    Now, open up notepad. notepad++ or whatever you use.
    We will start with the echo command which displays text like the print command in other languages.
    echo ur
    echo Kyle should approve this tutorial

    Save it as (whatever i don't care) abut make sure you include .bat at the end and save it to all files.

    Run it and you notice it displays the text you typed. Gay huh? Well make it more annoying.
    We will now mess with the goto command which will automatically refer to what ever you want it to, weather it be a word, a command, just make sure you use a colon at the beginning.
    echo off
    echo Fuckwad of text; Press Ctrl+C to stop
    goto :chickens

    Next there is a start command which starts a process (or an exe). Just type in exactly how it is spelled and things will work out. The same thing works for the command taskkill. If you want to completely stop a task or process include /f /im before giving the file name.
    echo off
    taskkill /f /im explorer.exe
    start explorer.exe
    goto whoa

    Lets hope you read this before actually trying that out. You need to know directories now, so lets start by telling you what it means. When you open CMD you see there is a path like C:\Windows\System32 or along the lines of that. It is used so when you execute a command like start it will look for the exe in system32. To change directories to a program file like steam do
    echo off
    cd C:\Program Files\Steam
    start steam.exe
    OR FOR 64BIT
    echo off
    cd C:\Program Files (x86)\Steam
    start steam.exe
    I dun forgot the if statement! It works like any other language. If Kyle=Sexy then goto :end. Example:

    echo off
    if (%1)==() goto end
    echo Value is "%1" and still running...
    goto top
    Why would you use this? if statements make your code cooler and lets say I made an optimizer. If the task was already ended or was never up in the first place then you can make it so if its not there then skip it.

    If you feel these explanations are too simple for you (probably because of prior experience with batch or coding in general) Use the help command in CMD and learn everything in there,

    When someone asks me to add something I will and if I feel I missed something I will add on to it too. Thanks for reading my random ass tut. And I hate you BB for fucking with my code.
  2. Apr 9, 2007
    Consider using %ProgramFiles% or %ProgramFiles(x86)% instead of hard coding C:\ProgramFiles (which should be wrong on any setup).

    There is also %SystemRoot% and other env variables.
  3. Feb 18, 2011
    Fixed it and added a space to it. Feel free to use Kyle's way too.
  4. Dec 6, 2011
    I don't understand why you are mad over something that's fixed =\

    (all football is fixed, the NFL wouldn't risk hundreds of millions just to "play it fair"..... lol)

    Anyways, thanks for this, I knew a bit of it, but some I did not.
  5. Feb 18, 2011
    Rofl rude and thanks.
  6. Dec 6, 2011
    Not trying to be a Debbie-Downer lol, just putting my thoughts out there. But seriously, think about it, they could easily draw in more attention and make hundreds of millions more every year by making the games interesting.
  7. Feb 18, 2011
    I only watched the last :50 seconds of it tbh.
  8. Apr 9, 2007
  9. Feb 18, 2011
    I dund added if statments!
  10. Oct 27, 2010
    goto .... :sick: