Batch file

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
m
(PRONOM)
Line 4: Line 4:
 
|extensions={{ext|bat}}, {{ext|cmd}}, {{ext|btm}}
 
|extensions={{ext|bat}}, {{ext|cmd}}, {{ext|btm}}
 
|released=1981
 
|released=1981
 +
|pronom={{PRONOM|x-fmt/413}}
 
}}
 
}}
 
'''Batch files''' are files under the various versions of PC/MS-DOS, Windows, OS/2, and compatible systems which contain commands to be interpreted by the command-line DOS interpreter of those systems. Commands are found one per line (with CR+LF, hex 0D 0A, separating lines), and are executed as if typed directly into the command line. They can include execution of any programs which can be run from the command line, though once the other program starts running its input/output is under that program's control and does not come from the batch file (though the batch file continues executing once the program terminates).
 
'''Batch files''' are files under the various versions of PC/MS-DOS, Windows, OS/2, and compatible systems which contain commands to be interpreted by the command-line DOS interpreter of those systems. Commands are found one per line (with CR+LF, hex 0D 0A, separating lines), and are executed as if typed directly into the command line. They can include execution of any programs which can be run from the command line, though once the other program starts running its input/output is under that program's control and does not come from the batch file (though the batch file continues executing once the program terminates).

Revision as of 01:19, 16 July 2014

File Format
Name Batch file
Ontology
Extension(s) .bat, .cmd, .btm
PRONOM x-fmt/413
Released 1981

Batch files are files under the various versions of PC/MS-DOS, Windows, OS/2, and compatible systems which contain commands to be interpreted by the command-line DOS interpreter of those systems. Commands are found one per line (with CR+LF, hex 0D 0A, separating lines), and are executed as if typed directly into the command line. They can include execution of any programs which can be run from the command line, though once the other program starts running its input/output is under that program's control and does not come from the batch file (though the batch file continues executing once the program terminates).

Often the first line of the batch file is @ECHO OFF, which suppresses display of the command lines as they execute. (Early DOS versions didn't support the preceding @ sign which suppresses display of that line, so they just had ECHO OFF which accomplished the desired output suppression for subsequent lines, but did display that line first.)

The traditional file extension for batch files is .bat, but Windows NT introduced a new extension .cmd for batch files, intended to be used for batch files specific to this version of Windows and not intended to be executed on earlier systems. (The old .bat extension works in both old and new systems.) Yet another extension, .btm, was used in the third-party 4DOS and 4NT.

Programs in DOS can exist with a numeric errorlevel, which can be used in batch files to determine the flow of control.

AUTOEXEC.BAT is a special filename which, when placed in the root directory of a drive, causes that particular batch file to be executed automatically when the system is booted from that drive.

References

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox