Search code examples
c#windows-7windows-vistadirectory

How to find the path of the "Shared Documents" folder from c#?


In Windows Vista, the special folder "Shared Documents" contains documents accessible by all the users in the machine. That folder was renamed to "Public Documents" in Windows 7.

How can I find its physical path from c#?

Note that Environment.GetFolderPath(Environment.SpecialFolder.xxx) doesn't have the folder I'm looking for.


Solution

  • Path.Combine(Environment.GetEnvironmentVariable("PUBLIC"), "Documents");