Setting Environment variables in C# that persist after execution is complete
<p>I need to setup an environment variable from a C# program so batch files that run later can use this newly created variable.  I have tried using:</p>

<pre><code>Environment.SetEnvironmentVariable("USRNAM", "My Name", 
                                    EnvironmentVariableTarget.Process);
</code></pre>

<p>After this statement I have a breakpoint setup and when it gets to this breakpoint, I go to a Command Prompt, issue the following command:</p>

<pre><code>C:\Users\Lenovo&gt;SET USRNAM
</code></pre>

<p>I get:</p>

<pre><code>Environment variable USRNAM not defined.
</code></pre>

<p>How can I set an Environment variable that persists after the C# program execution has completed?</p>

<p>Suggestions are very much appreciated.</p>
