For command. Batch file

Microsoft Windows xp professional w/serv...
July 30, 2010 at 15:13:22
Specs: Windows XP
How do I format the For command?
I have this in my script.

for /F "tokens=1-3" %a in (C:\data.txt) do set %a

I am trying to get it to read the first 3 lines of a text file.
text file:


and make those variables inside my batch file. the batch file will use the pause command after this. After i load my batch file it just closes.

See More: For command. Batch file

Report •

July 30, 2010 at 15:54:19
Well, I can get the 4 numbers out of the text file. (I'm not to good with the for command)


FOR /f "tokens=2 delims==" %%a IN (test1.txt) DO ECHO %%a

Maybe you can work with that

Report •

July 30, 2010 at 16:49:40
This might help:

@echo off
setlocal enabledelayedexpansion

for /f "tokens=*" %%1 in (c:\data.txt) do (
    set /a line+=1
    if !line! gtr 3 goto printit
    set var!line!=%%1

echo Var1=%var1%  Var2=%var2%  Var3=%var3%

Report •

July 30, 2010 at 19:03:53
mind if i just... copy that?

his hit what i needed right on the head

Report •

Related Solutions

Ask Question