C#操作系统安装目录 [英] C# operating system installed directory

查看:107
本文介绍了C#操作系统安装目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用C#查找安装了操作系统(例如Windows 7)的驱动器?然后,我必须获得Program Files目录.

How do I find the drive, using C#, in which I installed the operating system (say, Windows 7)? Then I have to get the Program Files directory.

推荐答案

使用Environment.GetFolderPath(Environment.SpecialFolder.System);,对于程序文件文件夹,使用Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);.

Use Environment.GetFolderPath(Environment.SpecialFolder.System);, and for the program files folder use Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);.

这篇关于C#操作系统安装目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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