Tuesday 18 October 2011

Dos Batch File - Creation

MS Dos Batch File is wonderful creation of Windows which allows Windows users to create a series of commands and put them in a Batch file and then execute the commands on a mouse click.

A DOS Batch file will have a extension as .BAT and this file can be executed directly in the Windows GUI by double clicking it.

Below is a sample example of Batch file used to set the Date and Time using a Batch file

Step 1: Goto Run -> Type cmd -> Command prompt opens -> Type Cd\
Step 2:  Create a new directory for flexibility. Here I am going with Temp
Step 3: Create a file Example. bat as shown below

Step 4: Once the bat file is created go C:\Temp and you should be able to see the bat file created Example.bat
Step5: Double click on the Example.bat it would prompt you would see the System date and it would prompt to enter the new Date. once you enter the Date it would ask for Time is a similar fashion.

Similarly the Batch file can be created using a notepad do not forget to save the notepad file as .bat extension file. 

This article is one small example. There are much more to come. Stay tunned.

Upcoming atriciles
1. Declaring variables in a batch file
2. Opening other non MSDos applications 

PS: Please provide your feed back. Your feedback is most important to improve and provide better articles.

No comments:

Post a Comment