Search code examples
c#windowsfilesystemsdirectory

How to get a path to the desktop for current user in C#?


How do I get a path to the desktop for current user in C#?

The only thing I could find was the VB.NET-only class SpecialDirectories, which has this property:

My.Computer.FileSystem.SpecialDirectories.Desktop

How can I do this in C#?


Solution

  • string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);