Batch Files
Batch files are the computer user's magic carpet—magic hammock, really. Whereas data entry and repetitious tasks can have you seriously considering hemlock, a batch file can take all your woes and tie them up in a neat little package to which you need only say the magic word, "Run!" Before the age of Windows, batch files consisted of lists of actions for a program executable to read and do. The Windows operating system is much more complicated than its predecessor, the DOS environment (now known as the "Command Line"), and for a time the lament of the PC community was the demise of batch files. But ah-hah! For some time now, the magic hammock is back, and you can package up all your repetitions and relax! Our series of tips can take you from the starting line to concocting your own private .bat files.
Tips, Tricks, and Answers
The following articles are available for the 'Batch Files' topic. Click the article''s title (shown in bold) to see the associated article.
Creating a Simple Batch File
One of the powerful capabilities built into Windows is the ability to create and use batch files to perform a wide variety of tasks. This tip serves as an introduction to creating and invoking a simple batch file.
Running a Batch File at a Scheduled Time
Once you become comfortable with batch files, chances are that you'll want to use them to perform various system maintenance tasks. One way to ensure these tasks regularly occur is to have them automatically run at scheduled times. This tip provides an example of how to run a batch file at a scheduled time using the Task Scheduler.
Using Batch Files, Part 1
This tip is part of a series that shows you how to create and use Windows batch files. It introduces a few commands and the idea of using parameters in your file.
Using Batch Files, Part 2
This tip is part of a series that talks about Windows batch files. It introduces a few more commands and special characters you can use in your files.
Using Batch Files, Part 3: The IF Command
This tip is part of a series that talks about Windows batch files. It introduces a few more commands you can use in your files.
Using Batch Files, Part 4: The CALL Statement
This tip is part of a series that talks about Windows batch files. It introduces a few more commands you can use in your files.
Using the FOR Statement
In another tip we were introduced to the various FOR loops that exist in Windows. The actual use of these loops was left as an exercise for the reader. Due to popular demand, though, this tip provides a couple of uses for FOR loops.
Using the SHIFT Statement
Sometimes your batch file needs to accept an unknown number of parameters. This is easy to deal with if you know about the SHIFT statement as described in this tip.