Batch file
Encyclopedia
In DOS
DOS
DOS, short for "Disk Operating System", is an acronym for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions 95, 98, and Millennium Edition.Related...

, OS/2
OS/2
OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "Personal System/2 " line of second-generation personal...

, and Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

, batch file is the name given to a type of script file
Scripting language
A scripting language, script language, or extension language is a programming language that allows control of one or more applications. "Scripts" are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the...

, a text file
Text file
A text file is a kind of computer file that is structured as a sequence of lines of electronic text. A text file exists within a computer file system...

 containing a series of commands
Command (computing)
In computing, a command is a directive to a computer program acting as an interpreter of some kind, in order to perform a specific task. Most commonly a command is a directive to some kind of command line interface, such as a shell....

 to be executed by the command interpreter.

The commands may be built into the command processor (COPY), supplied with the operating system but not built into it (XCOPY invokes the Microsoft DOS program XCOPY.EXE), or may be any program (cp invokes the program cp.exe if present, an .EXE port of the Unix cp command, with essentially the same functionality as XCOPY.EXE).

Similar to job control language
Job Control Language
Job Control Language is a scripting language used on IBM mainframe operating systems to instruct the system on how to run a batch job or start a subsystem....

 and other systems on mainframe and minicomputer systems, batch files were added to ease the work required for certain regular tasks by allowing the user to set up a script to automate them. When a batch file is run, the shell
Shell (computing)
A shell is a piece of software that provides an interface for users of an operating system which provides access to the services of a kernel. However, the term is also applied very loosely to applications and may include any software that is "built around" a particular component, such as web...

 program (usually COMMAND.COM
COMMAND.COM
COMMAND.COM is the filename of the default operating system shell for DOS operating systems and the default command line interpreter on Windows 95, Windows 98 and Windows Me...

 or cmd.exe
Cmd.exe
Command Prompt is the Microsoft-supplied command-line interpreter on OS/2, Windows CE and on Windows NT-based operating systems...

) reads the file and executes its commands, normally line-by-line. Unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....

 operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

s (such as Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

) have a similar type of file called a shell script
Shell script
A shell script is a script written for the shell, or command line interpreter, of an operating system. It is often considered a simple domain-specific programming language...

.

The filename extension
Filename extension
A filename extension is a suffix to the name of a computer file applied to indicate the encoding of its contents or usage....

 .bat was used in DOS, and the Windows 9x
Windows 9x
Windows 9x is a generic term referring to a series of Microsoft Windows computer operating systems produced since 1995, which were based on the original and later modified Windows 95 kernel...

 family of operating systems. The Microsoft Windows NT
Windows NT
Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix. It was intended to complement...

-family of operating systems and OS/2 added .cmd. Batch files for other environments may have different extensions, e.g. .btm in 4DOS
4DOS
4DOS is a command line interpreter by JP Software, designed to replace the default command interpreter COMMAND.COM in DOS and Windows 95/98/Me. The 4DOS family of programs are meant to replace the default command processor. 4OS2 and 4NT replace CMD.EXE in OS/2 and Windows NT respectively...

 and 4NT
4NT
Take Command Console , formerly known as 4DOS for Windows NT and 4NT, is a command line interpreter by JP Software, designed as a substitute for the default command interpreter in Microsoft Windows...

 related shells.

There have been changes to the detailed handling of batch files; some of the detail in this article is applicable to all batch files, while other details apply only to certain versions.

Variants

Brief information on the function and parameters of commands are usually displayed by typing the command at the command prompt followed by "/?" and pressing the Enter key. In some cases "-?", "?", or just the command name without parameters (if parameters are required) will also elicit information. Some command ported from Unix require "--help".

DOS

In MS-DOS, a batch file can be started from the command line by typing its name followed by any required parameters and pressing the "enter" key. When MS-DOS loads, the file AUTOEXEC.BAT
AUTOEXEC.BAT
AUTOEXEC.BAT is a system file found originally on DOS-type operating systems. It is a plain-text batch file that is located in the root directory of the boot device...

 is automatically executed, so any commands that need to be run to set up the MS-DOS environment for use could be placed in this file. Computer users would have the autoexec file set up the system date and time, initialize the MS-DOS environment, load any resident programs or device drivers, or initialize network connections and assignments.

In MS-DOS
MS-DOS
MS-DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems, and was the main operating system for IBM PC compatible personal computers during the 1980s to the mid 1990s, until it was gradually superseded by operating...

, the extension ".BAT" identified a file containing commands which could be executed by the command interpreter COMMAND.COM
COMMAND.COM
COMMAND.COM is the filename of the default operating system shell for DOS operating systems and the default command line interpreter on Windows 95, Windows 98 and Windows Me...

 line by line as if it was a list of commands to be entered, with some extra batch-file-specific commands for basic programming functionality, including a GOTO command for changing flow of line execution.

Early Windows

Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

 was introduced in 1985 as a GUI
Gui
Gui or guee is a generic term to refer to grilled dishes in Korean cuisine. These most commonly have meat or fish as their primary ingredient, but may in some cases also comprise grilled vegetables or other vegetarian ingredients. The term derives from the verb, "gupda" in Korean, which literally...

 Operating System
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

 alternative to text-based operating and was designed to run on MS-DOS. In order to start it the WIN command was used and could be added to the end of the AUTOEXEC.BAT
AUTOEXEC.BAT
AUTOEXEC.BAT is a system file found originally on DOS-type operating systems. It is a plain-text batch file that is located in the root directory of the boot device...

 file to allow automatic loading of Windows. In the earlier versions one could run a .bat type file from Windows in the MS-DOS Prompt.

Windows was run from MS-DOS and used COMMAND.COM to run .bat files on the following operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

s:
  • Windows 1, 2 and 3
    Windows 3.0
    Windows 3.0, a graphical environment, is the third major release of Microsoft Windows, and was released on 22 May 1990. It became the first widely successful version of Windows and a rival to Apple Macintosh and the Commodore Amiga on the GUI front...

    .
  • Windows 95
    Windows 95
    Windows 95 is a consumer-oriented graphical user interface-based operating system. It was released on August 24, 1995 by Microsoft, and was a significant progression from the company's previous Windows products...

     and 98
    Windows 98
    Windows 98 is a graphical operating system by Microsoft. It is the second major release in the Windows 9x line of operating systems. It was released to manufacturing on 15 May 1998 and to retail on 25 June 1998. Windows 98 is the successor to Windows 95. Like its predecessor, it is a hybrid...

    .
  • Windows ME
    Windows Me
    Windows Millennium Edition, or Windows Me , is a graphical operating system released on September 14, 2000 by Microsoft, and was the last operating system released in the Windows 9x series. Support for Windows Me ended on July 11, 2006....

     (access to real mode
    Real mode
    Real mode, also called real address mode, is an operating mode of 80286 and later x86-compatible CPUs. Real mode is characterized by a 20 bit segmented memory address space and unlimited direct software access to all memory, I/O addresses and peripheral hardware...

     MS-DOS was restricted).

OS/2

The IBM
IBM
International Business Machines Corporation or IBM is an American multinational technology and consulting corporation headquartered in Armonk, New York, United States. IBM manufactures and sells computer hardware and software, and it offers infrastructure, hosting and consulting services in areas...

 OS/2
OS/2
OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "Personal System/2 " line of second-generation personal...

 operating system supported DOS-style batch files. It also included a version of REXX
REXX
REXX is an interpreted programming language that was developed at IBM. It is a structured high-level programming language that was designed to be both easy to learn and easy to read...

, which was a more advanced batch-file scripting language
Scripting language
A scripting language, script language, or extension language is a programming language that allows control of one or more applications. "Scripts" are distinct from the core code of the application, as they are usually written in a different language and are often created or at least modified by the...

. 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 made no difference on the way batch files worked from COMMAND.COM.

OS/2's batch file interpreter also supports an EXTPROC command. This passes the batch file to the program named on the EXTPROC file as a data file. The named program can be a script file; this is similar to the #!
Shebang (Unix)
In computing, a shebang is the character sequence consisting of the characters number sign and exclamation point , when it occurs as the first two characters on the first line of a text file...

 mechanism.

Windows NT

Windows versions other than the NT line of operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

s were run from MS-DOS and used the same command interpreter, COMMAND.COM
COMMAND.COM
COMMAND.COM is the filename of the default operating system shell for DOS operating systems and the default command line interpreter on Windows 95, Windows 98 and Windows Me...

, to execute batch files. However, the operating systems in the Windows NT
Windows NT
Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix. It was intended to complement...

 series run directly from booting the hard drive; they are true operating systems, not graphical user interfaces for underlying MS-DOS. An enhanced 32-bit command processor, cmd.exe, was introduced; it could execute scripts with either the .CMD or .BAT extension. Cmd.exe added additional commands, and implemented existing ones in a slightly different way, so that the same batch file (with different extension) might work differently with cmd.exe and COMMAND.COM. In most cases operation is identical if the few unsupported commands are not used. Cmd.exe's extensions to COMMAND.COM can be disabled for compatibility.

Microsoft released a version of cmd.exe for Windows 9x and ME called WIN95CMD to allow users of older versions of Windows to use certain cmd.exe-style batch files.

, cmd.exe is the normal command interpreter for batch files; the older COMMAND.COM can be run from within a cmd.exe window in 32-bit versions of Windows able to run 16-bit programs.

Filename extensions

  • .bat: The first extension used by Microsoft
    Microsoft
    Microsoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...

     for batch files. This extension runs with MS-DOS and all versions of Windows, under COMMAND.COM or cmd.exe, despite the different ways the two command interpreters execute batch files.
  • .cmd: The extension used by operating system
    Operating system
    An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

    s in the Windows NT family and sent to cmd.exe for interpretation. It does not work on computers relying on COMMAND.COM so prevents cmd.exe scripts from being executed in the wrong Windows environment. It is also used by IBM's OS/2 for batch files.
  • .btm: The extension used by 4DOS
    4DOS
    4DOS is a command line interpreter by JP Software, designed to replace the default command interpreter COMMAND.COM in DOS and Windows 95/98/Me. The 4DOS family of programs are meant to replace the default command processor. 4OS2 and 4NT replace CMD.EXE in OS/2 and Windows NT respectively...

     and 4NT
    4NT
    Take Command Console , formerly known as 4DOS for Windows NT and 4NT, is a command line interpreter by JP Software, designed as a substitute for the default command interpreter in Microsoft Windows...

    . The scripts run on 4DOS and 4NT are faster, especially with longer ones, as the script is loaded entirely ready for execution, rather than line-by-line.

Differences between .cmd and .bat execution in the Windows NT family

The only known difference between .cmd and .bat file execution is that in a .cmd file the ERRORLEVEL variable changes even on a successful command that is affected by Command Extensions (when Command Extensions are enabled), whereas in .bat files the ERRORLEVEL variable changes only upon errors.

Example

This example batch file displays "Hello World!", prompts and waits for the user to press a key, and terminates.

@ECHO off
ECHO Hello World!
PAUSE


To execute the file it must be saved with the extension .bat (or .cmd for Windows-NT type operating systems) in plain text format, typically by a text editor such as Notepad or a word processor
Word processor
A word processor is a computer application used for the production of any sort of printable material....

 in text mode.

Result

When executed (either from Windows Explorer
Windows Explorer
This article is about the Windows file system browser. For the similarly named web browser, see Internet ExplorerWindows Explorer is a file manager application that is included with releases of the Microsoft Windows operating system from Windows 95 onwards. It provides a graphical user interface...

 or Command Prompt) this is displayed:


Hello World!
Press any key to continue . . .

Explanation

The interpreter executes each line in turn, starting with the first. The @ symbol at the start of the line turns off the prompt from displaying that command. The command ECHO off turns off the prompt permanently, or until it is turned on again. Then the next line is executed, the ECHO Hello World! command outputs Hello World!, as only off and on have special functions. Then the next line is executed, the PAUSE command displays Press any key to continue . . . and pauses the script's execution until a key is pressed, when the script terminates as there are no more commands. In Windows, if the script is run within a Command Prompt window, the window remains open at the prompt as in MS-DOS, otherwise the command prompt windows closes on termination (unless the batch file has a command to prevent this).

Advanced Windows batch example - conditional shutdown


@echo off
color 3
title Conditional Shutdown
set /p name="enter a name:"
start

cls
echo Hi, %name%
echo.
echo 1.Shutdown
echo 2.Quit
invalid_choice

set /p choice="enter your choice 1,2: "
if %choice%

1 goto shutdown
if %choice%

2 exit
echo invalid choice: %choice%
goto invalid_choice
shutdown

cls
set /p sec="enter the number of seconds that you wish the computer to shutdown in: "
set /p message="enter the shutdown message you wish to display: "
shutdown -s -f -t %sec% -c "%message%"
echo shutdown initiated at %time%
set /p cancel="type cancel to stop shutdown "
if %cancel%

cancel shutdown -a
if %cancel%

cancel goto start



When doing conditions with IF command, batch commands can use:


EQU : Equal =
NEQ : Not equal

LSS : Less than <
LEQ : Less than or Equal <=

GTR : Greater than >
GEQ : Greater than or equal


Null values in variables

Variable expansions are substituted textually into the command, and thus variables which contain nothing simply disappear from the syntax, and variables which contain spaces turn into multiple tokens. This leads to syntax errors or bugs.

For example:

IF %foo%

bar ECHO Equal

if %foo% is empty, parses as the erroneous construct:

IF

bar ECHO Equal

and if %foo% contains "abc def", then the syntax is also wrong:

IF abc def

bar ECHO Equal

The usual way to prevent this problem is to surround variable expansions in quotes so that an empty variable expands into the valid expression IF ""

"bar" instead of the invalid IF

bar. The text that is being compared to the variable must also be enclosed in quotes, because the quotes are not special delimiting syntax; these characters represent themselves.

IF "%foo%"

"bar" ECHO Equal

The delayed !VARIABLE! expansion available in Windows 2000/XP/Vista/7 may be used to avoid these syntactical errors. In this case, null or multi-word variables will not fail syntactically because the value will be expanded after the IF command is parsed:
IF !foo!bar ECHO Equal

Quotation marks and spaces in passed strings

  • For some commands, spaces are treated as delimiters in commands, unless those spaces are enclosed by quotation marks. A single quotation mark (") is not included as part of the string. However, an escaped quotation mark (""") can be part of the string.
  • For other commands, spaces are not treated as delimiters and do not need quotation marks. If quotes are included they become part of the string.


This can cause conflicts where a string contains quotation marks, and is to be inserted into another line of text that must also be enclosed in quotation marks:

C:\> Set foo="this string is enclosed in quotation marks"

C:\> Echo "test 1 %foo%"
"test 1 "this string is enclosed in quotation marks""

C:\> Eventcreate /T Warning /ID 1 /L System /SO "Source" /D "Example: %foo%"
ERROR: Invalid Argument/Option - 'string'.
Type "EVENTCREATE /?" for usage.


Under Windows 2000/XP/Vista/7, the solution is to replace all occurrences of one quote characters by three quotes:


C:\> Set foo="this string is enclosed in quotes"

C:\> Set foo=%foo:"="""%

C:\> Echo "test 1 %foo%"
"test 1 """this string is enclosed in quotes""""

C:\> Eventcreate /T Warning /ID 1 /L System /SO "Source" /D "Example: %foo%"
SUCCESS: A 'Warning' type event is created in the 'Source' log/source.

Escaped characters in strings

Some characters have special meaning to the command line, such as the pipe | character. These cannot be printed as text using the ECHO command unless escaped using the caret ^ symbol:

C:\> Echo foo | bar
'bar' is not recognized as an internal or external command,
operable program or batch file.

C:\> Echo foo ^| bar
foo | bar


However, escaping does not work as expected when inserting the escaped character into an environment variable, and the variable ends up containing a live pipe command when merely echoed. It is necessary to escape both the caret itself and the escaped character for the character display as text in the variable:

C:\> set foo=bar | baz
'baz' is not recognized as an internal or external command,
operable program or batch file.

C:\> set foo=bar ^| baz
C:\> echo %foo%
'baz' is not recognized as an internal or external command,
operable program or batch file.

C:\> set foo=bar ^^^| baz
C:\> echo %foo%
bar | baz

The delayed !VARIABLE! expansion available in Windows 2000/XP/Vista/7 may be used to show special characters stored in environment variables because the variable value will be expanded after the command was parsed:

C:\> set foo=bar ^| baz
C:\> echo !foo!
bar | baz

Sleep or scripted delay

The PAUSE command halts script activity indefinitely until a key is pressed; small programs and workarounds were written to implement a timed pause. Many workarounds using scripting commands only worked in some environments, depending upon the CHOICE function not available in older command interpreters, PING only available if TCP/IP was installed, and so on. Simple small programs were readily available; a typical example is the 94-byte WAIT.COM executable; WAIT 5 would wait for 5 seconds, then return control to the script. Most such programs are 16-bit .COM files incompatible with 64-bit Windows, but are not needed since Windows Vista and later introduced the TIMEOUT command.

Text output with stripped CR/LF

Normally all printed text automatically has the control characters for "carriage return" and "line feed" appended to the end of each line.

batchtest.bat:
@echo foo
@echo bar

C:\>batchtest.bat
foo
bar


It does not matter if the two echo commands share the same command line; the CR/LF codes are inserted to break the output onto separate lines:

C:\> @echo foo&@echo bar
foo
bar


A trick discovered with Windows 2000/XP/Vista/7 is to use the special prompt for input to output text without CR/LF trailing the text. In this example, the CR/LF does not follow Line 1, but does follow Line 2 and Line 3:

batchtest.bat:
@echo off
set foo=Line 1
echo y | set /p tmp="%foo%"
echo Line 2
echo Line 3

C:\>batchtest.bat
Line 1Line 2
Line 3

C:\>


This can be used to output data to a text file without CR/LF appended to the end:

C:\> echo y | set /p tmp="Line 1"> data.txt
C:\> echo y | set /p tmp="Line 2">> data.txt
C:\> echo y | set /p tmp="Line 3">> data.txt
C:\> type data.txt
Line 1Line 2Line 3


However, there is no way to inject this stripped CR/LF prompt output directly into an environment variable.

Setting a UNC working directory from a shortcut

It is not possible to have a command prompt that uses a UNC file path as the current working directory, like this:

\\server\share\directory\>

The command prompt requires the use of drive letters to assign a working directory, which makes running complex batch files stored on a server UNC share more difficult. While a batch file can be run from a UNC file path, the working directory will default to "C:\windows\system32\"

In Windows 2000/XP/Vista/7, a workaround is to use the PUSHD and POPD command with command extensions. Quoting the help for PUSHD in Windows 7, If Command Extensions are enabled the PUSHD command accepts network paths in addition to the normal drive letter and path. If a network path is specified, PUSHD will create a temporary drive letter that points to that specified network resource and then change the current drive and directory, using the newly defined drive letter. Temporary drive letters are allocated from Z: on down, using the first unused drive letter found.

If not enabled by default, command extensions can be temporarily enabled using the "/E:ON" switch for the command interpreter.

So to run a batch file on a UNC share, assign a temporary drive letter to the UNC share, and use the UNC share as the working directory of the batch file, a Windows shortcut can be constructed that looks like this:

Target: %COMSPEC% /E:ON /C "PUSHD """\\SERVER\SHARE\DIR1\DIR2\""" & BATCHFILE.BAT & POPD"

The working directory attribute of this shortcut is ignored.

Character set

Batch files use a DOS character set, as defined by the computer, e.g. Code page 437
Code page 437
IBM PC or MS-DOS code page 437 is the character set of the original IBM PC. It is also known as CP 437, OEM 437, PC-8, MS-DOS Latin US or sometimes misleadingly referred to as the OEM font, High ASCII or Extended ASCII....

. The non-ASCII parts of these are incompatible with the Unicode
Unicode
Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...

 or Windows character sets
Windows code page
Windows code pages are sets of characters or code pages used in Microsoft Windows from the 1980s and 1990s...

 otherwise used in Windows so care needs to be taken.
Other Windows scripting languages
The cmd.exe command processor that interprets .cmd files is supported in all 32- and 64-bit versions of Windows . COMMAND.EXE, which interprets .BAT files, was supported in all 16- and 32-bit versions up to at least Windows 8 preview.

While the more powerful 2006 Windows PowerShell
Windows PowerShell
Windows PowerShell is Microsoft's task automation framework, consisting of a command-line shell and associated scripting language built on top of, and integrated with the .NET Framework...

 is favored in later versions of Windows that support it, Microsoft was also using .cmd files as far as, at least, Window Server 2008. An example is servermanagercmd.exe which incorporates the entire set of Server Manager functions for Windows Server 2008.

There are other, later and more powerful, scripting languages produced by Microsoft for Windows:
  • KiXtart
    KiXtart
    KiXtart is a free-format scripting language for Windows. It is described as a logon script processor and enhanced batch scripting language by the official website. Its name is a portmanteau of "kick start".-Overview:...

     (.kix) - developed by a Microsoft employee in 1991, specifically to meet the need for commands useful in a network logon script while retaining the simple 'feel' of a .cmd file.
  • Windows Script Host
    Windows Script Host
    The Microsoft Windows Script Host is an automation technology for Microsoft Windows operating systems that provides scripting capabilities comparable to batch files, but with a greater range of supported features...

     (.vbs and .js) - released in 1998, (consisting of cscript.exe and wscript.exe) runs scripts written in VBScript
    VBScript
    VBScript is an Active Scripting language developed by Microsoft that is modeled on Visual Basic. It is designed as a “lightweight” language with a fast interpreter for use in a wide variety of Microsoft environments...

     or JScript
    JScript
    JScript is a scripting language based on the ECMAScript standard that is used in Microsoft's Internet Explorer.JScript is implemented as a Windows Script engine. This means that it can be "plugged in" to any application that supports Windows Script, such as Internet Explorer, Active Server Pages,...

    . It can run them in windowed mode (with the wscript.exe host) or in console-based mode (with the cscript.exe host). They have been a part of Windows since Windows 98
    Windows 98
    Windows 98 is a graphical operating system by Microsoft. It is the second major release in the Windows 9x line of operating systems. It was released to manufacturing on 15 May 1998 and to retail on 25 June 1998. Windows 98 is the successor to Windows 95. Like its predecessor, it is a hybrid...

    .
  • Windows PowerShell
    Windows PowerShell
    Windows PowerShell is Microsoft's task automation framework, consisting of a command-line shell and associated scripting language built on top of, and integrated with the .NET Framework...

     (.ps1) - released in 2006 by Microsoft and can operate with Windows XP
    Windows XP
    Windows XP is an operating system produced by Microsoft for use on personal computers, including home and business desktops, laptops and media centers. First released to computer manufacturers on August 24, 2001, it is the second most popular version of Windows, based on installed user base...

     (SP2/SP3) and later versions. PowerShell can operate both interactively (from a command-line interface) and also via saved scripts, and has a strong resemblance to Unix
    Unix
    Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

     shells.


Cross-platform
Cross-platform
In computing, cross-platform, or multi-platform, is an attribute conferred to computer software or computing methods and concepts that are implemented and inter-operate on multiple computer platforms...

 scripting tools including Perl
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...

, Python
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

, Ruby
Ruby (programming language)
Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...

 and Rexx
REXX
REXX is an interpreted programming language that was developed at IBM. It is a structured high-level programming language that was designed to be both easy to learn and easy to read...

 are available for Windows.

Script files will run if the filename without extension is entered. There are rules of precedence governing interpretation of, say DoThis if several of DoThis.cmd, DoThis.bat, DoThis.exe, etc. exist; by default DoThis.com has highest priority. This default order may be modified in newer operating systems by the user-settable PATHEXT environment variable
Environment variable
Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer.They can be said in some sense to create the operating environment in which a process runs...

.
See also

  • VBScript
    VBScript
    VBScript is an Active Scripting language developed by Microsoft that is modeled on Visual Basic. It is designed as a “lightweight” language with a fast interpreter for use in a wide variety of Microsoft environments...

  • JScript
    JScript
    JScript is a scripting language based on the ECMAScript standard that is used in Microsoft's Internet Explorer.JScript is implemented as a Windows Script engine. This means that it can be "plugged in" to any application that supports Windows Script, such as Internet Explorer, Active Server Pages,...

  • Windows PowerShell
    Windows PowerShell
    Windows PowerShell is Microsoft's task automation framework, consisting of a command-line shell and associated scripting language built on top of, and integrated with the .NET Framework...

    , extensible command-line shell released in 2006
  • List of DOS commands
  • Shell script
    Shell script
    A shell script is a script written for the shell, or command line interpreter, of an operating system. It is often considered a simple domain-specific programming language...

    - UNIX equivalent

External links
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK