19 READING FILES AND OTHER INPUTS

By far the most involved syntax and powerful functionality of the already powerful for command is unleashed with the /F option, which allows for file reading. The optionless for command can do quite a bit with a file such as getting its name, path, drive, size, and attributes, pretty much everything concerning a file except its actual contents. Enter the /F option.

After introducing its syntax, I’ll demonstrate how to read a file, record by record. You’ll learn how to manipulate the input data, place the entire contents of a record into a variable, or break it into what Batch calls tokens. By tokenizing ...

Get The Book of Batch Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.