title: Batch file to sort txt after appending from other txt
body: <p>I'm wanting a batch file that I can drag a text file onto (preferrably multiple text files at once) which will read each text file line by line and add each line to a specified destination text file. Destination text file will not contain any duplicated lines, and will be sorted alphabetically. A source file will never contain the same line twice, but may contain non-alphanumeric characters such as: { - : _ ~ !</p>
  
  <p>Example:</p>
  
  <p>a.txt:</p>
  
  <pre><code>apple
  banana
  garbage carrot
  {Elmer Fudd}
  </code></pre>
  
  <p>b.txt</p>
  
  <pre><code>1 tequila
  2 tequila
  3 tequila
  garbage carrot
  {Bugs Bunny}
  </code></pre>
  
  <p>destination.txt before:</p>
  
  <pre><code>{daffy duck}
  floor
  </code></pre>
  
  <p>destination.txt after dragging a.txt and b.txt onto the batch file:</p>
  
  <pre><code>{Bugs Bunny}
  {daffy duck}
  {Elmer Fudd}
  1 tequila
  2 tequila
  3 tequila
  apple
  banana
  floor
  garbage carrot
  </code></pre>
  
  <p>I've got it started:</p>
  
  <pre><code>@echo off
  setlocal disabledelayedexpansion
  set "sourcefile=%~1"
  echo "%sourcefile%" &gt; temp.txt
  for /f "delims=;" %%F in (%sourcefile%) do (
      echo %%F&gt;&gt;temp.txt
  )
  
  del /q destination.txt
  ren temp.txt destination.txt
  </code></pre>
  
  <p>It copies the file dragged into a temp file, but I can't figure out how to get it sorted. The sort command does NOT work for me, it just hangs the program up. All help is appreciated. Thank you!</p>