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

Chapter 12. Batch Files for Fun and Prof... > Processing Multiple Items with the F...

Processing Multiple Items with the For Command

You'll often want to write batch files that process “all” of a certain type of file. Command-line programs can deal with filename wildcards: For example, you can type delete *.dat to delete all files whose name ends with .dat. In batch files, you can accomplish this sort of thing with the for loop.

Note

If you have a Unix background, the need for special statements to deal with wildcards may seem confusing at first. On Unix and Linux systems, the command shell expands all command line arguments with wildcards into a list of names before it starts up the command, so to the command it appears that the user typed out all of the names. This is called globbing. On DOS and Windows, the shell doesn't do this. When command-line arguments contain wildcard characters, it's up to the command or batch file to expand the name into a list of filenames.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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