How to read a file with delimitted name value pairs using DOS batch script?


[ Follow Ups ] [ Post Followup ] [ The EasyDOS Forum ] [ FAQ ]

Posted by kannan on February 13, 2011 at 10:33:31:

I have a file with each line of the format name=value. I need to read it using a DOS script and store all the name value pairs in memory. The names are from a predefined list of names, so I can have a list of DOS variables, and assign values to them as and when a line is read from the file. Please provide the script for doing this. I'm not able to even do as much as read a file using the below code which I got on the internet, it printes nothing:
FOR /F %i IN (regfort.properties) DO @echo %i


The file tobe read is like this:
name1=value1
name2=value2

As the names are pre-defined, when the batch file reads the first line it will set the variable %name1% to value1 and while reading the 2nd line it will set the variable %name2%.



Follow Ups:



Post a Followup (use TAB key to move between boxes - NOT ENTER or RETURN)

Name:
E-Mail:

Subject:

Type your comments in the box below and SUBMIT:


[ Follow Ups ] [ Post Followup ] [ The EasyDOS Forum ] [ FAQ ]