title: Environment is not being set in windows using c#. Where am I going wrong?
body: <pre><code>string path = System.Environment.GetEnvironmentVariable("Path");
  Console.WriteLine(path);
  if (!path.Contains("C:\ccstg"))
  {
      if (!path.EndsWith(";"))
          path = path + ';';
      var v=@"C:\ccstg;";
      path = path + v;
      Environment.SetEnvironmentVariable("Path",path);
      Console.WriteLine(path);
      Console.WriteLine("Path Set");
      Console.ReadKey();
  }
  </code></pre>
  
  <p>I am trying to set path environment variable using c#, I am able to get "Path" but while setting it is not being set. It doesn't show any error either. I have tried running it as administrator also , no help.</p>
  
  <p>Does anybody what am I missing here ?</p>