Reputation: 83
I want to create a environment variables using C# and VB.Net code and able to Read,Delete and Set values to the new created variable. help me with code to do this process.
Upvotes: 8
Views: 12450
Reputation: 467
You can use Environment.SetEnvironmentVariable
to create, modify or delete environment variable and
Environment.GetEnvironmentVariable
for retrieve it.
Reference: https://learn.microsoft.com/en-us/dotnet/api/system.environment.setenvironmentvariable?view=netframework-4.7.2 To delete you set it to null.
Upvotes: 13