Windows Batch Script
Windows Batch Script is a programming language specific to Windows platform computers. It is sometimes referred to as "Batch File",, "MS-DOS commands" or simply "DOS commands", for it is the modern day equivalent of the MS-DOS command line. The commands are almost the same as they were in the MS-DOS era, with newer commands thrown in with the advent of the Internet. This language is usually written either in a simple text editor like Notepad (with a .bat file extension), or typed and executed immediately in a Windows Command Prompt, which can be found by typing "cmd" into the Run (Windows+R) box.
Examples
[edit | edit source]are some programming example using the Windows Batch Script language. Type these into Notepad:
@echo off ver title Encyc Batch Examples echo Hello, Encyc! pause set /p calculation=Enter your calculation: set /a calculator=%calculation% echo %calculation%=%calculator% pause
When saved in Notepad as encyc.bat (filetype All Files), you can then go to your file explorer and open "encyc.bat". It will open your new Batch program in Command Prompt. When it finds it, it will do the following:
- Displays the version number of Windows you are using.
- Displays the text "Hello, Encyc!"
- Asks for a calculation, such as 5+5; text inputted at a prompt is automatically saved as just text, not a number.
- Converts that text into a number.
- Outputs the plain-text calculation followed by the result number.