title: How to insert a new path into system path variable if it is not already there
body: <p>I'm using the below command to append a path to windows system PATH variable :</p>
  
  <pre><code>setx PATH "%PATH%;%ProgramFiles%\MySQL\MySQL Server 5.5\bin"
  </code></pre>
  
  <p>It works fine.</p>
  
  <p>My question is:</p>
  
  <p>How to append a path (%ProgramFiles%\MySQL\MySQL Server 5.5\bin in this case) into system PATH variable while also checking that it is not already there, and not adding it twice if it does?</p>