Thursday, August 16, 2012

How to create Batch File?


What is batch file? (bat file)
Batch file is a text file that contains one and more command, it has also called as batch program and script.

Extension of batch file
Extension of the batch file is .bat or .cmd.

What batch files do?
Batch files automate everyday task or repetitive task.

How can be batch file useful?
Using Batch file you can do routine task or repetitive task in shorten time.

How the batches file useful in testing?
There has so many task which we do regular basis like build deployment, or else some other task like for which you do manually That can be automated using the batch file.


How to create batch file?
Let me tell you batch file contains series of DOS command, instead of typing same command again and again you can just create a batch file and double click on it.
1.Open the notepad
2.Save the file ---    2.a Click on file >>Save
                               2.b Click on Save as type:  and select drop down menu All file
                               2.c Type the file name with .bat extension and save the file somewhere on  your 
                                     Desktop.
                               2.d Eg: Test.bat and then click on save button
3.Let’s we see a simple example of batch file: Batch file for opening facebook site using mozila firefox browser
 @echo off
start /d "C:\Program Files(x86)\Mozilla Firefox" firefox.exe www.faceboo.com
@echo off    
                                                                          
4.Type those command in Test.bat file, and save it.

5.Double click on Test.bat file for run


Command Explanation:  
Echo off:  BAT writers typically put this at the beginning of their files. It means that the program won’t show the command that you told it to run while it’s running.

Start:  It’s open program ,script,command in new window.In above example by using start command we opening the Facebook site using mozila Firefox browser.

There are several Commands available using those you can create batch file and you can automated your regular and repetitive task.

1 comment:

  1. brillant piece of information, I had come to know about your web-page from my friend hardkik, chennai,i have read atleast 9 posts of yours by now, and let me tell you, your webpage gives the best and the most interesting information. i'm already your rss reader now and i would regularly watch out for the new posts, once again hats off to you! Thanx a million once again, Regards, create batch file

    ReplyDelete