Friday, February 29, 2008

Batch Files

Batch files can be created, edited, and run from the command prompt window. You can also run a batch file from the RUN command by entering the location and filename. As the name implies, you can run several executable files from a filename you have created with the .bat extension. These files will be run in the order that they appear and can also have more batch files nested within the original batch file. This command originated in DOS and has several lines of test you can enter for a variety of tasks.
As previously mentioned, if you would like to run a batch file from a batch file, you would use the CALL command with the second batch filename directly after. You can also enter some limited logic such as the IF function to check for a condition. These functions may direct the system to a different batch file or to exit depending on the result of the condition. After the secondary function is complete, except for an exit command, the system will return to the next line of the batch program until it's completed. This would be a good tool if you have several files that need to run repeatedly.
There is also an option for creating an executable file from you batch file. This requires you to purchase a separate compiler program.

No comments: