Sunday, November 13, 2011

Batch Files: getting started


Hi, today i wanna start a new series of topics on writing of a batch file to run on a windows machine....A lot of people run windows, so i felt this is a good way to get more from your window's machine.
Batch files allow MS-DOS and Microsoft Windows users to create a lists of commands to run one after the other once the batch file has been execute. Think of them as a to-do list of all what you want your computer to do.
For example, you could write a batch file to run frequently run commands, deleting a series of files, moving files, etc, you get the idea...just basic understanding of MS-DOS commands
is needed to write a batch file.
A good example of a batch file for someone who is more familiar with Windows or the MacOS is to think of a batch file as a shortcut in Windows or an icon on the MacOS. Much like a shortcut, batch files could be used to run one or more commands or programs through the command line.
Another example of a very well known batch file is the autoexec.bat, which is a simple boot file loaded each time the computer is loaded on MS-DOS and early Windows computers. This batch file contained all the necessary commands and programs used to run MS-DOS and Windows each time the computer booted.
As you can see the extension of a batch file is .bat or .cmd, files of this type are recognized and executed through an interface (sometimes called a shell) provided by a system file called the command interpreter. In Windows XP/ Vista the command interpreter is the file cmd.exe. The large assortment of versatile commands available in Windows XP/Vista/7 makes batch files a powerful tool.
Constructing a batch file consists of nothing more than opening any text editor like the accessory Notepad, entering some lines containing commands, and saving the file with an extension BAT or CMD. (The CMD extension is limited to newer Windows systems and is not recognized in Windows 9x/Me systems. In Windows XP, Vista, and 7 there is little practical difference between the two extensions.)

  * Don't use Wordpad or Word unless you are very careful to save all files in pure text format. The commands themselves are often quite simple and there is no need to learn a programming language. Those who wish can explore the intricacies that are available with branching and looping, just follow the links. I will be discussing straightforward application of batch files to everyday tasks. The focus will be on saving time and effort for some routine stuff like system housekeeping and simple file management.
....so stay tuned....

No comments:

Post a Comment