title: Windows CLI equivalent to "sort -u"
body: <p>I need an equivalent way in a Windows CLI to do what I would be able to in Linux/UNIX in piping through to show unique values.</p>
  
  <p>I don't think there is a command as such, from what I can gather, so is there another way to do this?</p>
  
  <p>What I have to achieve is to list files from multiple directories (whether they exist or not, which I currently do using <code>dir</code>).  The way that the script (for the requesting application) works uses multiple sources to construct a directory list and subsequently the command depending on whether the platform is Windows or UNIX but the danger here is that there is a possibility of duplicate directories in the list and this would skew the results at the other end.</p>
  
  <p>The easiest way to deal with this is to do it at source, i.e. the original command being run.  So in Linux, the command structure is more or less:</p>
  
  <pre><code>find [dir] [dir] [dir] | grep file_name | sort -u
  </code></pre>
  
  <p>Doing the same in Windows is obviously more difficult given that:</p>
  
  <ul>
  <li>it has to be a native read only command/script string you would use from Windows Command Prompt (<code>cmd.exe</code>)</li>
  <li>I can't install anything on the hosts this is run on</li>
  <li>I can't create temporary text files as part of the process</li>
  </ul>