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

后端 未结 2 957
借酒劲吻你
借酒劲吻你 2021-02-12 05:54

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:24

    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.

提交回复
热议问题