title: Batch file to read lines from text file which may contain reference of other file
body: <p>I have some text files which contains some SVN path. These text file will also contain the reference of some other text file which will contain the SVN path and may contain reference to other text file.</p>
  
  <p>Lets see example below:</p>
  
  <p><strong>text1.txt</strong></p>
  
  <pre><code>http://svnlink1
  http://svnlink2
  #file#&gt;reference_txt1.txt
  #file#&gt;reference_txt2.txt
  </code></pre>
  
  <p><strong>reference_txt1.txt</strong></p>
  
  <pre><code>http://svnlink3
  http://svnlink4
  http://svnlink5
  http://svnlink6
  </code></pre>
  
  <p><strong>reference_txt2.txt</strong></p>
  
  <pre><code>http://svnlink7
  http://svnlink8
  #file#&gt;reference_txt3.txt
  </code></pre>
  
  <p>Here <strong>text1.txt</strong> is my base file which contains 2 SVN links and 2 references of other text files.</p>
  
  <p>All I want is to write the SVN links from all the files whose reference is present in any of the file to some other file say <strong>output.txt</strong>.</p>
  
  <p>Please ask if question is clear or any more details are required.</p>
  
  <p>What I have tried </p>
  
  <pre><code>@echo off
  
  cd C:\Users\user\Desktop\
  C:
  
  :readLine
  for /f "tokens=*" %%a in (text1.txt) do call :processline %%a
  
  pause
  goto :eof
  
  :processline
  set line=%*
  IF line contains #file#&gt; (
  call:readLine %line%
  )
  ELSE (
  echo %line% &gt;&gt; output.txt
  )
  goto :eof
  
  :eof
  </code></pre>