• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 13. Command Prompt Tools > Working with Batch Files

Working with Batch Files

A batch file is a file that contains Command Prompt commands and commands from other utilities, such as the NET command. Batch files have many uses, but perhaps one of the most common is to create user logon scripts. You can configure a batch file that uses specific commands to configure a user's environment when the user logs into the system. Unix developers use batch files to simplify system administration tasks. Scripting and batch files are a topic for an entire book, but here just remember that many of Windows XP's GUI applications (such as Dynamic Host Configuration Protocol, or DHCP, and Dynamic Name System, or DNS) have an equivalent set of commands that can be used at the Command Prompt, and thus with batch files.

To create a batch file you use an ordinary ASCII text editor. Enter the commands you want to execute one line after another. You can use pipes and filters in batch files so that the input or output from one command can be used by another command. You can create temporary files. You can also use a few other items in your batch files to make them act almost like programs. For example, in Table 13.3, you may have noticed the if command, as well as the goto and for commands. These can be used to make your batch file execute some commands, depending on the results of previous commands. This conditional branching gives you the capability to make creating batch files that can adapt to different conditions or selections made by users.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint