0

Users can easily rename special folders like Computer, Network etc. to whatever they like. Also if the computer is using a different locale, the name of those folders will also be different.

I want to get the current names of all special folders like Computer, Recycle Bin, Network etc. in my app. Is there a way to do this? A specific API? A registry value?

For eg, user renames My Computer to Super Computer. My app should show that My Computer's name is Super Computer.

Elmo
  • 6,409
  • 16
  • 72
  • 140
  • 2
    what is different from [this](http://stackoverflow.com/questions/8810606/identify-all-open-system-special-folders/8810658#8810658) question? Seems to me there is an explanation how to get Special folders from the system already. – Tigran Jan 11 '12 at 20:52
  • 1
    the folders you specify are not *real* IO entities, they are not folders, so they have not path. – Tigran Jan 11 '12 at 20:58
  • Some of those aren't actual folders (like Network, Computer). What would you want returned instead of a drive and directory name? – Ken White Jan 11 '12 at 21:01

1 Answers1

2

He is not looking for a directory path, he simply wants the current name of the My Computer shortcut.

Consider if you right click on My Computer and click Rename and set the name to be "Awesome Computer". How can you find this value via C#?

If I open up regedit and do a "Find" on "Awesome Computer" the following is returned:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}

You can retrieve this value in C# using the Registry.GetValue method. You can find the registry path to the Network, Recycle Bin, etc using the same method of setting them to a unique name and running a registry search.

Update

It appears that if the user has not renamed My Computer, and it is still set to the default, then the registry value will be null. In this case you can look at the following registry value to find the default name:

HKEY_USERS\S-1-5-21-1070759151-1144338347-1905203885-52919\Software\Microsoft\Windows\ShellNoRoam\MUICache
@C:\WINDOWS\system32\SHELL32.dll,-9216

Here is a list of the different defaults:

8503 S&earch... 8964 Recycle Bin 9216 My Computer 9217 My Network Places 9227 My Documents 9319 Printers and Faxes

Just search for value @C:\WINDOWS\system32\SHELL32.dll in registry find them all.

jzacharuk
  • 2,058
  • 1
  • 16
  • 22
  • I have my doubts.. You will probably need to handle each on its own. But, you now have the knowledge on where to look to find them. – jzacharuk Jan 11 '12 at 21:56