The following registry key contains many system default folder locations.
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
The value for the path of the All Users desktop, which is found there, is as follows:
XP or earlier : %ALLUSERSPROFILE%\Desktop
Vista or later: %PUBLIC%\Desktop
Whereas the actual paths of the All User desktops, respectively, are as follows:
XP or earlier : "C:\Documents and Settings\All Users\Desktop"
Vista or later: "C:\Users\Public\Desktop"
Now, if you use copy and paste the above registry values in Windows Explorer and hit enter it takes you to the actual folders. For example, if you paste [%PUBLIC%\Desktop] in a Windows Explorer in Vista it takes you to ["C:\Users\Public\Desktop"].
My question is this; how do I reproduce this behavior from withing a C# program? To be more specific, if I retrieve the registry value [%PUBLIC%\Desktop] from withing a C# program, which I can do easily, how do I convert it to ["C:\Users\Public\Desktop"]? Obviously I'm not looking for a string replacement, I need to do what Windows does.