[英]C# operating system installed directory
如何使用 C# 找到驅動器,我在其中安裝了操作系統(例如 Windows 7)? 然后我必須獲取 Program Files 目錄。
使用Environment.GetFolderPath(Environment.SpecialFolder.System);
, 對於程序文件文件夾使用Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
.
看看這個鏈接。 Environment.GetEnvironmentVariable
希望能為您完成這項工作。
string systemDrive = Path.GetRoot(Environment.GetFolderPath(Environment.SpecialFolder.System));
string progamFilesPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.