Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

how do i make batch files

minor59erminor59er Member Posts: 7
I want to learn how to make a batch file.
Im new at this so if anyone could give me a site or could tell me how to do it then that would be greatful.

Comments

  • BASIC FriendBASIC Friend Member Posts: 354
    : I want to learn how to make a batch file.
    : Im new at this so if anyone could give me a site or could tell me how to do it then that would be greatful.
    :
    There are Batch tuts out there. I don't have the url's right now, but you should find something if you do a search.

    Ok, Batches are easy. All they are is Dos commands. Open your editor and type in a few dos commands (one on each line) save it as *.bat and that's pretty much it. There are commands like IF ERRORLEVEL that are useful only in batches.

  • Stoic JokerStoic Joker Member Posts: 84
    Greetings
    Use any text editor to create the file, just remember to put the file name in quotation marks when you save it i.e. "myfile.bat" This will allow it to be saved as an executable batch file & not let windows force the default .txt extension on it.

    Stoic Joker

    : I want to learn how to make a batch file.
    : Im new at this so if anyone could give me a site or could tell me how to do it then that would be greatful.
    :

  • Secret_DoomSecret_Doom Member Posts: 116
    : I want to learn how to make a batch file.
    : Im new at this so if anyone could give me a site or could tell me how to do it then that would be greatful.
    :

    Hi. I disagree a little with BASIC Friend. Batch is indeed a simple language, even more if we compare it to other languages.

    But as any computer language, Batch can reach very complex levels. It is a simple language because the number of commands is small, but you can do many things with it. When one reaches the level of using DEBUG combined with batch files, it gets really complex (but of course, very exciting =D ).

    Just for giving ya an example of the variety of things you could do by batch:

    - Shortcuts
    Let's say you have the following app:
    c:myfilesdataapps rirdppack
    ewvercheck.exe
    And you don't want to make the following every time:
    cdmyfiles
    cd data
    cd apps
    ...etc
    or even
    cdmyfilesdataapps rirdppack
    ewver
    So, you put the following line at a file, and name it with a .bat extention (without the quotes):
    "start c:myfilesdataapps rirdppack
    ewvercheck.exe"
    or even simpler, just:
    "c:myfilesdataapps rirdppack
    ewvercheck.exe"
    Let's say you named the batch as "ch.bat" (without the quotes), and placed it at a directorypath, such as c:windows. Then you will only has to type "ch" to enter the application.

    - Routine clean up files (e.g.: delete all .TMP files from a certain directory every time the computer is booted)

    Those where simple tasks. But you can do some complex things:

    - Routine backups
    - Cadastre programs. I've done one, a very good work for a friend of mine. Each cadastre has name, telephone number, adress, email, games that the person plays and games that the person masters (RPG). The options are many: you may modify cadastres, get total number of cadastres, search cadastres with a certain criteria (e.g.: list all names of people who play AD&D) and many other things.

    Some people say it's a useless language for these days. I don't think so.
    But I must say that when regarding math, it fails indeed. There is just no how to do 1+1, like you would do in any other language. It's not impossible, since I've done myself a calculator for batch (but it took me three months to develop!)

    Below are some links:

    TWO FAQS (second one is mine =D)
    http://home7.inet.tele.dk/batfiles/main/batchfaq.htm
    http://www.secretdoom.hpg.com.br/us/faq.html

    A DOS forum:
    http://computing.net/dos/wwwboard/wwwboard.html

    A newsgroup (here are some of the best experts in the matter of batch, but I don't know if it would be a good idea to ask begginners questions there, sometimes they aren't very polite, you know...)
    news:alt.msdos.batch

    A link page:
    http://www3.sympatico.ca/rhwatson/dos7/links.html

    That's all I've got to you. I don't remember of any tutorials, but just make a search at a search engine for "batch tutorial" you'll find something (or at the links page I listed above)

    -- Secret_Doom - Leonardo Pignataro --

    secret_doom@hotmail.com
    www.batch.hpg.com.br
  • Zell1388Zell1388 Member Posts: 82
    Simple. Start out with something like:

    @echo off

    which will help you with writing text. Then you could type something like:

    echo Hello, World!

    to print Hello, World! on the screen. Use various DOS commands like

    C:KEENKEEN1.EXE

    or

    cd windows

    or

    win

    I think you kind of get the point by now...
Sign In or Register to comment.