Environment.SpecialFolder Enum

If you are interested in the .NET Enum “Environment.SpecialFolder” and would like to know what the corresponding literal directory paths are for those special folder enum values, then you may be interested in this script.

The following script will loop through the Environment.SpecialFolder enum and display the physical directory path for which each particular enum value is associated with (or retrieves).

Here is the code:

class Program

{

    static void Main(string[] args)

    {

        // Note I added HTML tags to make the output a little bit easier for viewing in this post

        Console.WriteLine("<table><tr><th>Environment.SpecialFolder Name</th><th>Directory Path</th></tr>");

        foreach (string specialFolderName in Enum.GetNames(typeof(Environment.SpecialFolder)))

        {

            Environment.SpecialFolder specialFolder;

            Enum.TryParse(specialFolderName, out specialFolder);

            string path = Environment.GetFolderPath(specialFolder);

            Console.WriteLine("<tr><td>{0}</td><td>{1}</td></tr>", specialFolderName, path);

        }

        Console.WriteLine("</table>");

        Console.ReadLine();

    }

}

Here is the Output: Note that when the code was executed, the current user was “Jed”. Also, this was executed on Windows Server Standard 2008

Environment.SpecialFolder Name Directory Path
Desktop C:\Users\Jed\Desktop
Programs C:\Users\Jed\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
Personal C:\Users\Jed\Documents
MyDocuments C:\Users\Jed\Documents
Favorites C:\Users\Jed\Favorites
Startup C:\Users\Jed\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Recent C:\Users\Jed\AppData\Roaming\Microsoft\Windows\Recent
SendTo C:\Users\Jed\AppData\Roaming\Microsoft\Windows\SendTo
StartMenu C:\Users\Jed\AppData\Roaming\Microsoft\Windows\Start Menu
MyMusic C:\Users\Jed\Music
MyVideos C:\Users\Jed\Videos
DesktopDirectory C:\Users\Jed\Desktop
MyComputer
NetworkShortcuts C:\Users\Jed\AppData\Roaming\Microsoft\Windows\Network Shortcuts
Fonts C:\Windows\Fonts
Templates C:\Users\Jed\AppData\Roaming\Microsoft\Windows\Templates
CommonStartMenu C:\ProgramData\Microsoft\Windows\Start Menu
CommonPrograms C:\ProgramData\Microsoft\Windows\Start Menu\Programs
CommonStartup C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
CommonDesktopDirectory C:\Users\Public\Desktop
ApplicationData C:\Users\Jed\AppData\Roaming
PrinterShortcuts C:\Users\Jed\AppData\Roaming\Microsoft\Windows\Printer Shortcuts
LocalApplicationData C:\Users\Jed\AppData\Local
InternetCache C:\Users\Jed\AppData\Local\Microsoft\Windows\Temporary Internet Files
Cookies C:\Users\Jed\AppData\Roaming\Microsoft\Windows\Cookies
History C:\Users\Jed\AppData\Local\Microsoft\Windows\History
CommonApplicationData C:\ProgramData
Windows C:\Windows
System C:\Windows\system32
ProgramFiles C:\Program Files
MyPictures C:\Users\Jed\Pictures
UserProfile C:\Users\Jed
SystemX86 C:\Windows\system32
ProgramFilesX86 C:\Program Files
CommonProgramFiles C:\Program Files\Common Files
CommonProgramFilesX86 C:\Program Files\Common Files
CommonTemplates C:\ProgramData\Microsoft\Windows\Templates
CommonDocuments C:\Users\Public\Documents
CommonAdminTools C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools
AdminTools C:\Users\Jed\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools
CommonMusic C:\Users\Public\Music
CommonPictures C:\Users\Public\Pictures
CommonVideos C:\Users\Public\Videos
Resources C:\Windows\resources
LocalizedResources
CommonOemLinks
CDBurning C:\Users\Jed\AppData\Local\Microsoft\Windows\Burn\Burn
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s