HiveBrain v1.2.0
Get Started
← Back to all entries
snippetcsharpCritical

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

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
howtheforcurrentuserpathdesktopget

Problem

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);

Code Snippets

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

Context

Stack Overflow Q#634142, score: 965

Revisions (0)

No revisions yet.