title: CMD/Batch extract each text file line and loop from variable
body: <p>I have this code</p>
  
  <pre><code>@Echo Off 
  SetLocal EnableDelayedExpansion 
  SET mydir=D:\ 
  SET DirCount=2 
  SET T=
  For /F %%i In (qqq.txt) Do (  
    set fg=%%i 
    FOR /L %%G IN (2, 1, %DirCount%) DO (call :subroutine "%%i") 
  )
  
  :subroutine 
  Set T=!T!../ 
  start /wait %mydir%program.exe %T%%fg% 
  echo %t%%fg%  &gt;&gt;%cd%see.log
  </code></pre>
  
  <p>qqq.txt has rows</p>
  
  <pre><code>1
  2
  3
  </code></pre>
  
  <p>In result i get:</p>
  
  <pre><code>../1
  ../../2
  ../../../3
  ../../../../3
  </code></pre>
  
  <p>But I need like this:</p>
  
  <pre><code>../1
  ../../1
  ../2
  ../../2
  ../3
  ../../3
  </code></pre>
  
  <p>Please Help what I'm doing wrong?</p>
  
  <hr>
  
  <p>Just a little additional requried</p>
  
  <p>I need what first ocur in </p>
  
  <pre><code>set "T=!T!../"
  will be without dots
  set "T=!T!/"
  result must be
  /1
  ../1
  ../../1
  /2
  ../2
  ../../2
  </code></pre>
  
  <p>how and where to add counter and make visible for each loop somthing like </p>
  
  <pre><code>echo Now looping: %%i row of %countrow(in qqq.txt), left %countrow-%%I
  echo Now looping: Dir Nr%%G !T!%%i
  </code></pre>
  
  <p>Sorry for stupid questions but batch coding is difficult to me.</p>