Environment variables in C#
c#
Solution
You can do this:
string path = Environment.ExpandEnvironmentVariables(@"%ABC%/file.txt");
http://msdn.microsoft.com/en-us/library/system.environment.expandenvironmentvariables.aspx
Problem
I was using an environment variable which was named ABC and had a value of C:/ABC. In my code I used @"%ABC%/file.txt" for the file path where I had created a folder on the C drive called ABC containing a file called file.txt. However this does not recognise the environment variable. Is there any way to make this short-cut work or do I need to manually read the System Environment variable into a separate Environment variable using `Environment.GetEnvironmentVariable` Method (String) within Visual Studio?