title: Windows Command batch script to add filename to end of each row in a merged text file
body: <p>I a new to windows command line scripts. 
  I have a batch file which i use to merge multiple text files into one. However i want to be able to also add the name of the text file the row comes from to the end of each row in the merged file.</p>
  
  <p>This is the script i am currently working with:</p>
  
  <pre><code>@ECHO OFF
  ECHO Creating %1...
  FOR /F "usebackq tokens=1" %%G IN (`DIR /B "C:\My Documents\Data\*.txt"`) DO         
  (
  ECHO Adding %%G
  ECHO. &gt;&gt; Output.txt
  TYPE %%G &gt;&gt; Output.txt 
  ) 
  </code></pre>
  
  <p>Now i know that to get the filename into the output file i need to use:</p>
  
  <pre><code>ECHO %%G &gt;&gt; Output.txt 
  </code></pre>
  
  <p>However i'm not sure how i would add this to the current script so it adds the filename to each row and I have had no luck with finding any examples.</p>