title: Windows Batch Scripting: Collect unique occurences of a string in a file
body: <p>I have a file, in which the first string before the comma is some kind of identifier. Here is a sample:</p>
  
  <pre><code>A, bla, bla...  
  B, bla, bla...  
  A, bla, bla...  
  C, bla, bla...
  </code></pre>
  
  <p>I need to parse a file to collect all unique occurences of this string. So, ideally, after processing I would have some kind of array <code>[A, B, C]</code>. The problem is that officially arrays are not supported in batch scripting. I know there are some workarounds, but the ones I checked out looked quite ugly.</p>
  
  <p>What I have so far, is something like this:</p>
  
  <pre><code>FOR /F "tokens=1 delims=, " %%i in (%FILE%) do (
      echo %%i
  )
  </code></pre>
  
  <p>This produces the output:</p>
  
  <pre><code>A
  B
  A
  C
  </code></pre>
  
  <p>How do I eliminate the duplicate occurences of a string? What would be the elegant way to achieve this?</p>
  
  <p>Please, share your thoughts, on how this problem could be solved.</p>