by Dinesh Thakur Category: Introduction to Computer

A batch file is a text file containing a series of commands that the operating system will carry out for you, one at a time. A batch file is a batches (bundles or packages) of DOS commands into a single file. MS-DOS batch files consist of the normal operating system commands (e.g. DIR, DEL, COPY and MKDIR) together with some extra commands such as IF, FOR, GOTO, SHIFT and PAUSE that provide conditional control of execution and enable PARAMETERS to be passed so that the same batch file can be used in many different contexts. Under UNIX, batch files are called SHELL SCRIPTS, and are written in a c-like scripting language.

A batch file, such as WP.BAT, ends with the letters .BAT. When the user types in the name of a batch file and presses Enter at the DOS prompt, the commands in that batch file are performed one at a time-with no additional instructions from the user. For example, if the user typed WP and pressed Enter, WordPerfect (a popular word processing program) would start.

Batch files are great when you use a given set of commands repeatedly-instead of activating each command separately every time you want to carry out that set of commands, you can accomplish the same thing in one step.

A user can create a batch file to perform any routine task. For example, a batch file could be created to prepare a disk for use (a process called formatting). Because the commands are in a batch file, the user doesn't have to type them herself, or even remember what they are-all the user would have to do is type the name of this batch file to format a disk.

The most important batch file is the AUTOEXEC BAT. This file contains commands that are performed automatically each time the PC is turned on or restarted. Typical AUTOEXEC BAT commands include those which change the system prompt, display the current date and time, and set the directories in which DOS looks for files.

Batch files were very important before Windows came along, when everyone had to deal with DOS (the PC's operating system). DOS required the user to type everything in-which made each task tedious and easy to make mistakes. Batch files eliminated mistakes because the user no longer typed in the command, just the name of the batch file. With Windows, there is little typing involved in issuing commands.

Instead, the user selects commands from a list called a menu, or he selects an icon that represents the command he wants performed. Automation is still desirable in Windows, but instead of saving a list of typed commands, the user records his actions and saves them in a macro. A macro is like a batch file; when it's activated, the actions recorded in the macro are carried out.

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles