If your are connected with world of programming, you might have heard this word "Batch File". A batch file is used to execute a no of operations or a list of commands one after the other often requiring no user input. A no of operations are batched in a file to be executed sequentially when we run that file. In Microsoft Windows Operating system a batch file is a file saved with .bat extension while in other operating systems like Unix and Linux it can be written as a command file shell script.
Batch files are often used to load programs, run multiple processes
at a time, and perform common or repetitive tasks. For example, a batch job
could be used to back up many files on a computer system, process log files,
run a series of calculation commands, run multiple system diagnostic
processes, or any number of other things that require multiple commands to
be run. A big advantage of a batch job is that it can be started at any time
and left alone until they are completed, freeing up the time of one or more
people to perform other tasks.
Steps to create a batch file:
1) Open Any Text Editor (Say Notepad)
2) Go to Save As Option
3) Select All Files from Drop Down
4) Save file with an Extension of .bat
You have successfully created a batch file.
Now you can try out writing some commands in batch file.
Type "@echo off" into the first line of your batch file. This command stops the echo i.e. display of several repetitive lines in command line window.
REM is used to write comments in the batch file.
Lets try this code in your first batch file, it will open our Home page in IE:
@echo
off
REM This command will open our home page in IE start /d "C:\Program Files\Internet Explorer" iexplore.exe www.computertweaks.in |
