How to expand environment variable %CommonProgramFiles%\system\ in .NET

后端 未结 2 528
误落风尘
误落风尘 2021-02-12 05:47

I have a situation where I need to return a directory path by reading the registry settings. Registry value returns me a path in the format

%CommonProgramFiles%\         


        
2条回答
  •  天涯浪人
    2021-02-12 06:16

    Environment.ExpandEnvironmentVariables. If you control the creation of the registry value, store it as an expandable string in the registry and the registry API will automatically expand it for you.

提交回复
热议问题