What is batch file?

Batch/.bat file 
A batch file contains a series or batches of DOS based commands, which facilitate user to run commands in a sequential manner and avoid typing of same commands again and again. All batch file commands also can be run directly over a command prompt. Many operating system other that windows may contain a shell script or command file instead of batch file.

Creating a batch file:
Creating a batch file is very simple. Create a simple text file and save as batch file by changing the extension from ".txt" to ".bat".
(Refer the below screen shot)















Write into batch file

Just right click and edit file into notepad. now we can write a command which is applicable over command prompt. Here I am taking a very simple example of create a directory under "C:\" drive. Type the following command into "Batch/.bat" file -

"MD c:\TestBatch" and save. Now double click on the batch file.

Execution of the batch file will create a directory named "TestBatch" under "C:\" drive. To verify this go to "C:\" drive and check for "TestBatch" directory. It should be created. So in the same manner we can also write other complex commands.


Post a Comment

0 Comments