What are the Batch Files

written by: Johnny Stenthal; article published: year 2007, month 01;


In: Root » Computers and technology » Microsoft OS family » What are the Batch Files

Dutch French Spanish Portuguese Italian German Japanese Chinese Korean Russian Arabic Bookmark and Share this Article

Batch files are, in essence, command-line commands typed into a text file rather than typed directly at the command prompt. You can tell the command shell to read this text file and interpret its commands as if you were typing them. This serves several purposes:

  • It can save you a lot of typing, as you only need to type the batch file commands once, but you can have Windows run the commands as many times as you want. This is really important with long sequences of commands, but I even more frequently write what I call "tiny handy batch files," with single letter names, and perhaps only one command inside, to do things like change the current directory to a commonly used folder. These batch files can save you quite a bit of time and trouble.

  • You can write the batch file in such a way that it records steps of a particular job without storing the particulars; you can then provide the particulars when you use the batch file. For example, if you repeatedly have to extract and print information from different data files, you might write a batch file that performs these steps but doesn't contain the name of the actual data file to be processed. You can supply that name when you use the batch file. This, again, can save you time and mental energy: After the batch file is written, you don't have to think about what's inside the batch file. It's just a new Windows command that you can use whenever you need.

  • The contents of the batch file serve as a form of documentation, which lists the steps necessary to perform a particular job. A year after you've completed some project, you might have forgotten the steps involved in processing your data files, but you can always read the batch file yourself to refresh your memory.

Batch files can also use primitive programming commands to handle varying situations: "if a particular situation arises, do this, otherwise, do that" or "repeat this step for every file in a certain folder."

Disclaimer

1) E-articles is not responsible for the information contained by this article as well for any and all copyright infringements by authors and writers. E-articles is a free information resource. If you suspect this article for any copyright infringement, please read the terms of service and contact us to investigate the problem.
2) E-articles is not responsible for inaccuracies, falsehoods, or any other types of misinformation this article may contain and will not be liable for any loss or damage suffered by a user through the user's reliance on the information gained here.

link to this article