title: How would I set each line of a text document to separate variables using batch?
body: <p>How would I set a each line of a text document to separate variables using Batch? I know how to set a variable to the first line of a text document using:</p>
  
  <pre><code>Set /p Variable=&lt;Test.txt
  </code></pre>
  
  <p>...but I don't know how to read other lines of the file. Lets say for example I had a text document with 3 lines, the first line had 'Apples' written on it, the second had 'Bananas' and the third had 'Pears', and lets say the document was called Fruit.txt. How would I set the variable 'Line_1' to the first line of the document, 'Line_2' to the second line and 'Line_3' to the last line?. Just to keep it simple, lets just say the batch file and Fruit.txt are both in the same folder. I don't want to do this in VBScript, so please only post Batch code. I would have thought that it would be something like:</p>
  
  <pre><code>@Echo off
  Set /p Line_1=&lt;Fruit.txt:1
  Set /p Line_2=&lt;Fruit.txt:2
  Set /p Line_3=&lt;Fruit.txt:3
  Echo Fruit 1 is %Line_1%, Fruit 2 is %Line_2% and Fruit 3 is %Line_3%
  Pause
  Exit
  </code></pre>
  
  <p>...but quite clearly it isn't. Any help?</p>