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

Cristian Diaconescu picture Cristian Diaconescu · Mar 11, 2009 · Viewed 311.3k times · Source

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#?

Answer

Marc Gravell picture Marc Gravell · Mar 11, 2009
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);