-1

I'm trying to get the "Default Desktop Path"(a "Path" that brings me on the Desktop on "every" Pc).

I'm not good at programmings/english, Sorry. :( But i would love to get an answer. :)

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
Ken Zöggeler
  • 19
  • 1
  • 6
  • I mean that on every Computer i'll Start at the Desktop (i need it as a RootFolder) – Ken Zöggeler Jul 23 '14 at 11:18
  • Please don't ask new questions by unaccepting the answers to the original question, and then editing your previous question to ask completely different questions. That is simply not acceptable. If you want to ask a new question, ask a new question. If the site won't let you ask a new question, deal with that problem. If you want to ask again a question that has been closed, don't do that. Edit the closed question to address its problems. Then ask for the question to be reopened. – David Heffernan Jul 28 '14 at 11:44

3 Answers3

3

My guess is that you want:

Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)

Since you are looking for a directory path it makes more sense to me to use SpecialFolder.DesktopDirectory instead of SpecialFolder.Desktop. But I am of course guessing a little at your exact requirements.

Please refer to the following documentation:

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
3

If you want to get the file system path:

Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)

If you want to get the shell namespace folder:

Environment.GetFolderPath(Environment.SpecialFolder.Desktop)

P.S.: If you do not know the difference: What's the difference between SpecialFolder.Desktop and SpecialFolder.DesktopDirectory?

Community
  • 1
  • 1
sampathsris
  • 21,564
  • 12
  • 71
  • 98
2

I think you want this:

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

This returns the path of the Desktop folder. Much more powreful than any manual path building because the user could change this path.

Christian Sauer
  • 10,351
  • 10
  • 53
  • 85