开发者

Prevent Expansion of Environment Variables

开发者 https://www.devze.com 2023-03-01 01:44 出处:网络
I am currently developing an application meant to be an improved environment variables editor for Windows.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消