Wednesday, 17 September 2014

Batch Programming Overview

No comments :

Batch file programming is the native programming offered by the Microsoft Windows Operating
System. Batch file is created using any text editors like notepad, WordPad, WinWord or so on, which
comprises of a sequence of built-in commands used to perform some often done tasks like deleting a
series of files of same type or of different type, creating logs, clearing unwanted craps from your
computer and even for creating a batch VIRUS.

batch file is the name given to a type of script file, a text file containing a series of commands to be executed by the Command Interpreter.

A batch file may contain any command the interpreter accepts interactively at the command prompt. A batch file may also have constructs (IFGOTOLabels, CALL, etc.) that enable conditional branching and looping within the batch file. 


Batch file is really helpful in automating tedious tasks and for maintaining system logs. The commands used while creating a batch file are case insensitive, in the sense that it may accept both small and upper case letters. 

It is container for shell scripts.

File name extensions

.batThe first filename extension used by Microsoft 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. COMMAND.COM is a DOS program. Programs executed by COMMAND.COM are DOS programs that use the MS-DOS API to communicate with the operating system (DOS).

.cmd: Used for batch files in Windows NT family and sent to cmd.exe for interpretation. COMMAND.COM does not recognize this filename extension, cmd.exe scripts are not executed in the wrong Windows environment by mistake. In addition, "set", "path", "assoc" and "prompt" commands, when executed from a .bat file, alter the value of the "errorlevel" variable only upon an error, whereas from within a .cmd file, they would affect errorlevel even when returning without an error. It is also used by IBM's OS/2 for batch files.

.btm: The extension used by 4DOS and 4NT. The scripts that 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.


Batch Programs
A batch program can vary from 1 lines to millions of lines and it should be written into one or more text files with extension ".bat",".cmd",".btm";  for example, hello.bat. You can use "Notepad++""Notepad", " MS Word" or any other text editor to write your Batch program into a file.

No comments :