How do I make sense of a batch file? How do I make sense of a batch file? shell shell

How do I make sense of a batch file?


Once you get acquainted with the general .BAT file information, using some of the pointers to useful information that other users have posted in the other answers, you might try some of the following strategies that help you understand and analyze the BAT files used int your projects:

  1. add an ECHO command in front of all command invocations

  2. read HELP command for each command line in the BAT file

  3. execute at the command prompt each command line in the BAT file

  4. remove the @echo off at the top of the .BAT file, and see how the BAT progresses

  5. add some PAUSEs to keep viewing some commands on screen before they disappear.


There are some useful answers here in this Stack Overflow question: Best free resource for learning advanced batch-file usage?

As well there are quite a few resources available through google search for Batch file resources, as well as the Wikipedia entry http://en.wikipedia.org/wiki/Batch_files

That should get you started at least.


A little search on google should give a lot of tutorials and websites with information on writing them for both Windows and Linux.

Maybe you should start from the beginning though.

http://ss64.com/nt/

http://academic.evergreen.edu/projects/biophysics/technotes/program/batch.htm

http://www.robvanderwoude.com/batchcommands.php

http://en.wikipedia.org/wiki/List_of_MS-DOS_commands

They're just a few examples i found with a little google search. You should search it and find something thats better for you.

Hope this helps.