For /F problem - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

For /F problem

WillqwertyWillqwerty Posts: 4Member
I am running Vista sp2 and am having trouble with the FOR /F command. Ill show you my problem:

So far i have written this as a test for a larger program to come, but that doesn't matter

My program:

@echo off

For /F "tokens=1 delims= " %%G IN (Lines.txt) DO Set var=%%G

echo %var%

pause
exit

Lines.txt refers to a text file that looks like this:

a
b
c
d


If my understanding of FOR /F is correct it should only be able to extract 'a' & this is what i want it to do, but it keeps returning d, why is this, can i change it? Any help would be greatly appreciated!

Will

Sign In or Register to comment.