From Seo Wiki - Search Engine Optimization and Programming Languages
| This article needs additional citations for verification.
Please help improve this article by adding reliable references. Unsourced material may be challenged and removed. (May 2009) </td>
In DOS, OS/2, and Microsoft 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
DOS batch files have the filename extension .bat. Batch files for other environments may have different extensions, e.g. .cmd or .bat in the Microsoft Windows NT-family of operating systems and OS/2, or .btm in 4DOS and 4NT related shells. The now-obsolete Windows 9x family of operating systems only recognize the .bat and .btm extension.
Originally command interpreters' primary responsibility was to execute out commands entered manually. Such commands might involve starting programs, carrying out file operations, executing functions concerned with controlling the system, setting preferences or administrative tasks. Sequences of such commands were also sometimes stored in files, which could be later passed to the command interpreter to be read and executed, so such stored sequences could be termed sets of 'batch commands'.
Over time, command interpreters or 'shells' grew additional features, as such stored sequences of such 'batch commands' became more complex, and command interpreters evolved into something more akin to interpreters for a kind of limited programming languages or 'script'. Additional commands, advanced syntactic features and computation abilities were added which allowed sophisticated programs to be written so that batch files or scripts could contain a mixture of commands of the traditional.
Microsoft DOS batch language was influenced by various 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. Although a DOS batch file is analogous to a shell script in Unix-like operating systems, the syntax and range of commands available is less sophisticated.
The first example of Microsoft's batch files were the .bat files used by DOS. The operating system used
Enhancements and alternatives
The limitations of the DOS command intrepreter led to various non-Microsoft interpreters to provide enhanced syntax by providing "enhancement" commands such as those in the Norton Utilities (like the BE or Batch Enhancer), in 1989 the replacement shell 4DOS.
Microsoft Windows was introduced in 1985 as a GUI Operating System alternative to text-based operating and was designed to run on MS-DOS. In order to start it the
Windows was based on MS-DOS and used
The IBM OS/2 operating system supported DOS-style batch files. It also included a version of REXX, which was a more advanced scripting language. IBM and Microsoft started developing this system but during the construction of it broke up after a dispute, as a result of this IBM referred to their MS-DOS like console shell without mention of Microsoft; naming it just DOS, although this seemingly had no impact on the way batch files worked.
The Microsoft Windows NT-family of operating systems featured a second, new command interpreter
The only known difference between .cmd and .bat file processing is that in a .cmd file the
@echo off title Hello World echo Hello World echo. pause
To execute the file it must be saved with a .bat or .cmd extension in plain text format (with a program like Notepad).
@echo off color A title Conditional Shutdown :start cls set /p name=enter a name: cls echo Hi, %name% echo. echo 1.Shutdown echo 2.Quit set /p choice=enter your choice 1,2: if %choice%==1 goto shutdown if %choice%==2 exit :shutdown cls set /p sec=enter the amount of seconds that you wish the computer to shutdown in: set /p msg=enter the shutdown message you wish to display: shutdown -s -f -t %sec% -c %msg% echo shutdown initiated at %time% set /p cancel=type cancel to stop shutdown if %cancel%==cancel shutdown -a if %cancel%==cancel goto start
Hello World! Press any key to continue . . .
enter a name:
Batch files are executed by every line being executed in order until the end is reached or something else stops it (such as the key shortcut for terminating batch processing; 'Ctrl' + 'C'). This batch file first turns off the 'echo' with
Microsoft hasn't officially released information pertaining to the future of Command Prompt (host for .bat and .cmd files) yet, but the company is now starting to include Windows PowerShell in releases for newer Operating Systems, which has all the core functions of Command Prompt and more (and instead of .bat and .cmd files, it runs .ps1 files). Yet it is important to remember that it is not certain this will replace Command Prompt, and that Microsoft is still making important tools for Command Prompt specifically, instead of for PowerShell (such as
Other Windows scripting languages
In addition to traditional batch files, the need for more powerful capabilities has led to the development of other Windows-specific scripting languages: