title: Find group of words in a text file and extract the line to new text file
body: <p>txt contains word "hi" "hello" "aloha" as per below</p>
  
  <pre><code>hi
  
  hello
  aloha
  </code></pre>
  
  <p>And I have one more file abc.txt which contains many words including the above 3 words. Now I developed a PowerShell script to search the words in abc.txt and extract the line containing the words to a new file <code>done.txt</code>. I use 
  <code>-match</code> command to find the word.</p>
  
  <p>How to use the file ref.txt which contains the words for the finding, instead of declare the words in coding?</p>
  
  <p>I would like to develop it in cmd.exe instead of PowerShell.</p>
  
  <pre><code>$source = "C:\temp\abc.txt"
  $destination = "C:\temp\done.txt"
  
  $hits = select-string -Path $source -SimpleMatch "hi","hello","aloha"
  $filecontents = get-content $source
  
  foreach($hit in $hits)
  {
      $filecontents[$hit.linenumber-1]| out-file -append $destination
      "" |out-file -append $destination
  }
  </code></pre>