New to Envriroment Variable usage.
I am coding project setup tool and need to store some user specified project directory paths across sessions. Someone suggested Get/SetEvironmentVariable. So I set up a Windows Form with textBoxes to display the paths. When I load the form it uses GetEvironmentVariable, and the textBoxes populate as expected. but when I try to update values with SetEvironmentVariable , the textBoxes are empty and do not show the updated variable until rebooting.
private void button1_Click(object sender, EventArgs e)
{
Environment.SetEnvironmentVariable("my_project_dir", "C:\path\to\my\project" , EnvironmentVariableTarget.Machine );
textBox1.Text = Environment.GetEnvironmentVariable("my_project_dir", EnvironmentVariableTarget.Machine);
}