Friday, October 07, 2005
Getting data into environment variables
After all this time, I still have to write DOS batch files now and then. The one I'm working on now requires that I populate environment variables from a text file. This one was tough to search out with Google but eventually I found a page that lists many, many ways to read data from a file to a variable in batch:
http://www.student.northpark.edu/pemente/sed/bat_env.htm
There are two relatively easy solutions there - strings.exe, which is under a bit of a cloud due to Ziff Davis sending C&D letters to people using their 20K DOS program from 1992, and a method that uses SED to construct batch files on the fly which are called from the first batch file. Oy! :)
http://www.student.northpark.edu/pemente/sed/bat_env.htm
There are two relatively easy solutions there - strings.exe, which is under a bit of a cloud due to Ziff Davis sending C&D letters to people using their 20K DOS program from 1992, and a method that uses SED to construct batch files on the fly which are called from the first batch file. Oy! :)