title: How to set environment variable Path using C#
body: <p>I am trying to set path environment variable for <code>MySql</code>.</p>
  
  <p>I don't get an error, but my code doesn't work.</p>
  
  <p><strong>Code:</strong></p>
  
  <p>First:</p>
  
  <pre><code>string pathvar = @";C:\Program Files\MySQL\MySQL Server 5.1\bin\\";
  System.Environment.SetEnvironmentVariable("PATH", pathvar);
  </code></pre>
  
  <p>Second:</p>
  
  <pre><code>string pathvar = System.Environment.GetEnvironmentVariable("PATH");
  System.Environment.SetEnvironmentVariable("PATH", pathvar + @";C:\Program Files\MySQL\MySQL Server 5.1\bin\\");
  </code></pre>
  
  <p>Thank you for your help...</p>