title: Batch file to Copy particular lines from one text file to another text file
body: <p>I am very new to batch scripting. I don't have much knowledge about Batch Scripting.</p>
  
  <p>My doubt is how to copy only some line from text file to other text file.</p>
  
  <p>Say my File.txt is </p>
  
  <pre><code>This is sample file.
  I want copy this line.
  Also this line.
  But not this line.
  </code></pre>
  
  <p>I want to copy line 2 and 3, but not using their line number, because may change.</p>
  
  <p>This muchI have done till now:</p>
  
  <pre><code>@ECHO OFF
  SET InFile=abc.txt
  SET OutFile=Output.txt
  IF EXIST "%OutFile%" DEL "%OutFile%"
  SET TempFile=Temp.txt
  IF EXIST "%TempFile%" DEL "%TempFile%"
  
  IF EXIST "%OutFile%" DEL "%OutFile%"
  
  FOR /F "tokens=*" %%A IN ('FINDSTR "I want" "%InFile%"') DO (
      ECHO.%%A&gt; "%TempFile%"
      ECHO.%TempFile%&gt;&gt;"%OutFile%"
  REM CALL :RemovePrecedingWordA "%%A"
      )
  FOR /F "tokens=*" %%A IN ('FINDSTR " Also this" "%InFile%"') DO (
      ECHO.%%A&gt; "%TempFile%"
      ECHO.%TempFile%&gt;&gt;"%OutFile%"
  REM CALL :RemovePrecedingWordA "%%A"
      )
  </code></pre>
  
  <p>But its not working. Please help.</p>