如何在.NET中扩展环境变量%CommonProgramFiles%\ system \ [英] How to expand environment variable %CommonProgramFiles%\system\ in .NET

查看:40
本文介绍了如何在.NET中扩展环境变量%CommonProgramFiles%\ system \的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到一种情况,我需要通过阅读注册表设置来返回目录路径.注册表值以格式返回我的路径

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%\System\web32.dll

消费者代码希望使用

C:\Program Files\Common Files\System\web32.dll

如何在.net代码中解析此类目录路径?

How can I resolve such directory path in .net code?

推荐答案

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.

这篇关于如何在.NET中扩展环境变量%CommonProgramFiles%\ system \的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆