如何访问特定目录在Windows?目录、Windows

2023-09-04 12:09:52 作者:听我

什么是C#语法要检索Windows用户的桌面,文件夹以及其他系统文件夹?

What is the C# syntax to retrieve the user's desktop, documents folder and other system folders on windows?

推荐答案

您可以使用Environment.GetFolderPath与Environment.SpecialFolder枚举。例如:

You can use Environment.GetFolderPath with the Environment.SpecialFolder enumeration. For example:

string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);