title: Batch Script "for /f ..."
body: <pre><code>for /F "skip=n tokens=3 delims= " %%i in (myfile.txt) do echo %%i
  </code></pre>
  
  <p>Is it possible for <code>skip=n ...</code> to be a variable like <code>skip=%test% ...</code> where <code>%test%</code> has an integer value?</p>
  
  <p>So I'm trying to add a column of data and the location of this table in the file is given by a string. </p>
  
  <p>For Eg: </p>
  
  <pre><code>$startTable 
  
  0 1 4
  
  1 2 4
  
  2 1 4 
  
  $endTable 
  </code></pre>
  
  <p>So the location of this table is given by the line number associated with $startTable. I have the value of this stored in a variable(!test!) so I need the skip=!test! and then I start adding the third column until I hit $endTable.</p>
  
  <p>When I try;</p>
  
  <pre><code>for /f "skip=!test! tokens=3 delims= " %%j in (!INPUTFILE!) do (
  echo %%j
  if %%j == "$endTable" goto :break
  set /a test2+=%%j
  )
  :break
  </code></pre>
  
  <p>I get the following error;</p>
  
  <pre><code>!test! tokens=3 delims= " was unexpected at this time.
  </code></pre>
  
  <p>-GK</p>