tags:

views:

49

answers:

3

If a.txt contains

a b c
abc

The command for /f %x in (a.txt) do echo %x is printing

a
abc

What am I doing wrong?

+2  A: 
for /f "tokens=*" %x in (a.txt) do @echo %x

The @echo will prevent the echo line from being printed

The For loop example

Preet Sangha
@preet Neat; but does not echo `a b c` as the string. I still see `a`.
publicRavi
I've updated it with the example
Preet Sangha
funny how i never noticed the tokens part :)
publicRavi
A: 
for /f "delims=|" %i in (a.txt) do @echo %i

Inside "delims=|" you can use any character for the delimiter that is not part of the file

a_horse_with_no_name
A: 
trismarck