Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET: How do I find the Desktop path when Folder Redirection is on?

Tags:

.net

I have been using

Environment.GetFolderPath(Environment.SpecialFolder.Desktop)

to get the path to the user's desktop for ages now, but since we changed our setup here at work so we use Folder Redirection to map our users' Desktop and My Documents folders to the server, it no-longer works. It still points to the Desktop folder in C:\Documents and Settings, which is not where my desktop lives.

Any ideas on how to fix this?

Burns

like image 536
littlecharva Avatar asked Oct 25 '25 14:10

littlecharva


1 Answers

You need to use the DesktopDirectory special folder instead:

Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)

should give you the redirected directory.

like image 78
John Sibly Avatar answered Oct 27 '25 08:10

John Sibly



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!