title: Batch File Script to Copy Files (Input lines from a Text File) from one Folder to Another
body: <p>I have a text file EXAMPLE (as given below) which has the names of different files present in a folder. </p>
  
  <blockquote>
    <p>Filename1<br><br>
    Filename2<br><br>
    Filename3<br><br>
    .........</p>
  </blockquote>
  
  <p>Now, I have to use this text file as the input to copy the files in D:\  drive (filenames are taken from text file) to another folder. The Batch file I used is given below. </p>
  
  <pre><code>@Echo Off
  
  SetLocal EnableDelayedExpansion
  
  Set n= 0
  Set _InTextFile=D:\EXAMPLE.txt
  
  For /F "tokens=*" %%I IN (%_InTextFile%) DO (
  
  Set /a n+=1
  
  Set _var!n!=%%I
  
  set VAR=init
  
  for /f %%a in ('dir /b D:\%%I.asc') do set VAR=exists
  
  if %VAR%==exists
  
  xcopy * D:\New folder
  
  )
  
  Set _
  
  EndLocal
  
  cmd /k
  </code></pre>
  
  <p>Unfortunately, this Batch script is not working as I expected. It is not copying the specific files to the new folder location. Also, it is getting printed as</p>
  
  <blockquote>
    <p>Invalid number of parameters. </p>
  </blockquote>
  
  <p>Please try to help me to identify the exact problem in my Batch Script. How can I modify this script in order to copy only these specific files (as given in EXAMPLE text file) in the D:\ drive to the D:\New folder ? </p>
  
  <p>Thank You in advance for your help. </p>