Text-file processing is a common scripting function. It's so common, in fact, that the Microsoft Scripting Runtime Library's FileSystemObject object has the TextStream object, which provides properties and methods for processing text files. However, the command interpreter (cmd.exe) has one feature that's a step ahead of what the Scripting Runtime Library provides: string token parsing.
Cmd.exe provides token parsing with the For /f command. Token parsing lets you break a line of text into chunks, or tokens, for further processing. For example, suppose you have a text file named users.txt that contains lines following the format domainname;username;fullname;description. In the lines, semicolons (;) separate the tokens. Using the For /f command, you can parse each line and extract the username by using the following code in a .cmd script:
For /f "tokens=2 delims=;" %%t
in (Users.txt) Do Echo %%t
(Although this command appears on several lines here, it would appear all on one line in the script.) . . .

