Reputation: 1705
What is the C# syntax to retrieve the user's desktop, documents folder and other system folders on Windows?
Upvotes: 7
Views: 6564
Reputation: 564323
You can use Environment.GetFolderPath with the Environment.SpecialFolder enumeration. For example:
string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
Upvotes: 14
Reputation: 81660
Use:
string folder = Environment.GetFolderPath(Environment.SpecialFolder.*);
Where * is one of the enum values.
Upvotes: 7