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:var1=1
var2=2
var3=3
var4=4and 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.
Well, I can get the 4 numbers out of the text file. (I'm not to good with the for command) @ECHO OFF FOR /f "tokens=2 delims==" %%a IN (test1.txt) DO ECHO %%a PAUSEMaybe you can work with that
This might help: @echo off cls 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 ) :printit echo Var1=%var1% Var2=%var2% Var3=%var3%
@wahine
mind if i just... copy that?@matt
his hit what i needed right on the head
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |