Reading a text file with a .bat

March 28, 2009 at 00:11:22
Specs: Windows XP
Here is what I want to do is it possible, I have a number of lists and they each have 50 lines, I want to set each line of this list as a variable.

so for example:
SET inv01 = line 1 from text file
SET inv02 = line 2 from text file
and so on up to 50.

The rest of the program works if I set the values up manually, I'm wondering if I can automate this process. Any Idea's Ive looked around but cant seem to find an answer to this.


See More: Reading a text file with a .bat

Report •


#1
March 28, 2009 at 00:45:03
@echo off & setLocal EnableDelayedExpansion

set N=

for /f "tokens=* delims=" %%a in (myfile) do (
set /a N+=1
set var!N!=%%a
)

set v


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#2
March 28, 2009 at 05:13:06
Works perfect thanks alot :)

Report •

#3
March 28, 2009 at 08:36:47
M2 - Why the 'set v' ?

Report •

Related Solutions

#4
March 29, 2009 at 00:03:00
lee, just to 'show what was done'


=====================================
If at first you don't succeed, you're about average.

M2


Report •


Ask Question