Author : Admin
Last Modified : 30-Apr-2020
Complexity : Beginner

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


In C#, you can use the Environment class to get the path of Desktop for the current user.

Use below code 

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

C:\Users\[current user name]\Desktop