Hidden for /f Feature

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.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.