Hidden for /f Feature
Find out the little-known feature of the /f batch file command.
October 16, 2001
Editor's Note: Share your Windows 2000 and Windows NT discoveries, comments, problems, solutions, and experiences with products and reach out to other Windows 2000 Magazine readers (including Microsoft). Email your contributions (400 words or less) to [email protected]. Please include your phone number. We edit submissions for style, grammar, and length. If we print your submission, you'll get $100. Submissions and listings are available online at http://www.win2000mag.com/articles. Enter the InstantDoc ID number in the InstantDoc ID text box.
The for /f batch file command contains a little-known feature. As the following example shows, you can use multiple token selections in the statement.
for /f "tokens=1,2,3" %%a in (textfile.txt) do call:Func1 %%a %%b %%c
This command passes the first, second, and third tokens on the line in your batch file to Func1.
—Sandor Welfing
[email protected]
About the Author
You May Also Like