Prevent Expansion of Environment Variables
I am currently developing an application meant to be an improved environment variables editor for Windows.
I have used both System.Environment.GetEnvironmentVariables() and Registry to get them. However both methods expands the text between %, so instead of getting as instance %systemroot%/system32 I get C:/Windows/system32/ in my program.
Is there a way to prevent th开发者_运维技巧e expansion of these items?
When you are getting environment variables from the registry - you need to use a special flag: RegistryValueOptions.DoNotExpandEnvironmentNames
.
精彩评论