如何访问 Windows 中的特殊目录?

发布于 2024-09-18 15:54:39 字数 49 浏览 3 评论 0原文

在 Windows 上检索用户桌面、文档文件夹和其他系统文件夹的 C# 语法是什么?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

与君绝 2024-09-25 15:54:39

您可以将 Environment.GetFolderPathEnvironment.SpecialFolder 枚举。例如:

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

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

string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
日暮斜阳 2024-09-25 15:54:39

用途:

string folder = Environment.GetFolderPath(Environment.SpecialFolder.*);

其中 * 是枚举值之一。

Use:

string folder = Environment.GetFolderPath(Environment.SpecialFolder.*);

Where * is one of the enum values.

拥抱影子 2024-09-25 15:54:39
System.Environment.SpecialFolder.MyComputer

ETC。

System.Environment.SpecialFolder.MyComputer

etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文