Results for batch file
On this page:
 

(1) A file containing data that is processed or transmitted from beginning to end.

(2) A file containing instructions that are executed one after the other from beginning to end. See BAT file and shell script.



 
 
Wikipedia: batch file


Microsoft Batch File
File extension: .bat .cmd .btm
Type of format: Scripting

In MS-DOS, OS/2, and Windows, a batch file is a text file containing a series of commands intended to be executed by the command interpreter. When a batch file is run, the shell program (usually COMMAND.COM or cmd.exe) reads the file and executes its commands, normally line-by-line. A batch file is analogous to a shell script in Unix-like operating systems.

Batch files are useful for running a sequence of executables automatically. Many system administrators use them to automate tedious processes. Although batch files support elementary program flow commands such as if and goto, they are not well-suited for general-purpose programming.

DOS batch files have the filename extension .BAT. Batch files for other environments may have different extensions, e.g. .CMD in Windows NT and OS/2, or .BTM in 4DOS and related shells.

History

Microsoft DOS and Windows batch programming has evolved along with the product releases of these operating systems. The command interpreters that come with these operating systems provide two distinct modes of work: interactive mode (in which the user types commands at a prompt which are then executed immediately) and batch mode (which executes a predefined sequence of commands). The original concepts for both modes draw ideas from Unix shells, as well as other text-based command line interfaces from the early 1980s such as CP/M which in turn took much of their inspiration from TOPS-10 and TOPS-20 from Digital Equipment Corporation.

The MS-DOS operating system's batch program interpreter is 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. In MS-DOS, the most commonly used batch file was AUTOEXEC.BAT, a special batch file that is executed during the booting process.

The newest versions of Windows, Windows 2000 and XP,and Windows Vista are not based on MS-DOS, but on Windows NT. NT-based systems include the cmd.exe command-line interpreter, which is somewhat compatible with COMMAND.COM. 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. COMMAND.COM is still present under Windows NT operating systems for better backward compatibility.

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. Some of them are: WiSE and MSMS

The IBM OS/2 operating system contains a text based command facility that is related to the ones supplied with Microsoft operating systems. However, OS/2 evolution assumed replacement of .BAT files with REXX scripting.

Example

An example of a simple batch file:

rem echo off prevents the printing of each command to standard output.
@echo off
rem echo. prints a blank line.
echo.
echo Hello World, press any key to start AProgram.exe!
pause > nul
rem The first argument to the batch file can be referenced with "%1"
AProgram.exe %1
if errorlevel 1 goto error
echo.
echo AProgram has finished whatever it was doing.
goto end
:error
echo.
echo Something went wrong with AProgram.
:end

Uses in virus writing

Batch files have become popular for creating viruses, especially among script kiddies.[citation needed] This is due to the simple syntax, the low amount of programming knowledge required to use it and the fact that batch files will run on almost every Windows computer. While some more advanced virus writers might laugh at the simplicity of batch file viruses,[citation needed] they can cause large amounts of destruction very quickly (deleting the contents of the hard disk drive can be done with one command). However, batch files are unable to spread as viruses unless copied or sent onto another computer.

External links

Wikibooks
Wikibooks' [[wikibooks:|]] has more about this subject:

 
 

Join the WikiAnswers Q&A community. Post a question or answer questions about "batch file" at WikiAnswers.

 

Copyrights:

Computer Desktop Encyclopedia. THIS COPYRIGHTED DEFINITION IS FOR PERSONAL USE ONLY.
All other reproduction is strictly prohibited without permission from the publisher.
© 1981-2008 Computer Language Company Inc.  All rights reserved.  Read more
Wikipedia. This article is licensed under the GNU Free Documentation License. It uses material from the Wikipedia article "Batch file" Read more

Search for answers directly from your browser with the FREE Answers.com Toolbar!  
Click here to download now. 

Get Answers your way! Check out all our free tools and products.

On this page:   E-mail   print Print  Link  

 

Keep Reading

Mentioned In: