Batch file

From Academic Kids

In DOS and Windows, a batch file is a text file with a series of commands intended to be executed by the command interpreter (see command line interface). When the batch file is run, the shell program (usually command.com or cmd.exe) reads the file and executes its commands. A batch file is analogous to a shell script in Unix-like operating systems.

DOS batch files have the filename extension .BAT or .CMD. AUTOEXEC.BAT is a special batch file that is executed during the booting process.

The default behaviour of the shell is to print each command to standard output before executing it. This is usually not desired, so the command ECHO OFF is given at the beginning of a batch file to prevent that from happening. In that form, only the ECHO OFF command itself would be printed. Since individual commands may be prefixed with the @ character to be prevented from printing, most batch files start with the line @ECHO OFF.

History

Microsoft operating system batch programming has evolved along with the product releases of these operating systems. Command interpreters are provided with these operating systems that provide two distinct modes of work. First is the interactive mode, in which the user types commands at a prompt which are then executed immediately. The second is the batch mode, which executes a predefined sequence of commands, stored as a text file with the extension .bat. The original concepts for both functionalities draw ideas from Unix shells, as well as other text based command line interfaces from the early 1980s such as CP/M.

Originally, the MS-DOS operating system provided a batch program interpreter for the shell command.com. Batch programs for MS-DOS are composed of a relatively simple set of commands interpreted directly by command.com (internal commands) and utilities that exist as separate executables (external commands). The evolution of this branch of batch programming proceeded through the releases of MS-DOS, and into Windows 95, Windows 98 and finally Windows Me.

The newest Microsoft Windows versions, Windows 2000 and XP, are not based on MS-DOS, but on Windows NT, introduced before MS-DOS 6.0. In NT systems, a native MS-DOS environment is absent, but included is an MS-DOS compatible shell, cmd.exe. Some MS-DOS features are not available, but there are many additional features and commands not included with MS-DOS or MS-DOS based versions of Windows.

Various non-Microsoft command interpreters exist that provide enhanced batch program command syntax. An example of these is the 4DOS product.

Several non-Microsoft implementations of batch compilers exist to convert batch programs to directly executable programs. The quality-of-implementation of these compilers varies widely.

The IBM OS/2 operating system contains a text based command facility that is related to the ones supplied with Microsoft operating systems.

See also

External links

Navigation

Academic Kids Menu

  • Art and Cultures
    • Art (http://www.academickids.com/encyclopedia/index.php/Art)
    • Architecture (http://www.academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (http://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (http://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools