Environment.SpecialFolder Enumeration
.NET Framework Class Library
Environment..::.SpecialFolder Enumeration

Specifies enumerated constants used to retrieve directory paths to system special folders.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)
Visual Basic (Declaration)
<ComVisibleAttribute(True)> _
Public Enumeration SpecialFolder
Visual Basic (Usage)
Dim instance As Environment.SpecialFolder
C#
[ComVisibleAttribute(true)]
public enum SpecialFolder
Visual C++
[ComVisibleAttribute(true)]
public enum class SpecialFolder
JScript
public enum SpecialFolder
Member nameDescription
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkApplicationDataThe directory that serves as a common repository for application-specific data for the current roaming user.

A roaming user works on more than one computer on a network. A roaming user's profile is kept on a server on the network and is loaded onto a system when the user logs on.

CommonApplicationDataThe directory that serves as a common repository for application-specific data that is used by all users.
LocalApplicationDataThe directory that serves as a common repository for application-specific data that is used by the current, non-roaming user.
CookiesThe directory that serves as a common repository for Internet cookies.
DesktopThe logical Desktop rather than the physical file system location.
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkFavoritesThe directory that serves as a common repository for the user's favorite items.
HistoryThe directory that serves as a common repository for Internet history items.
InternetCacheThe directory that serves as a common repository for temporary Internet files.
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkProgramsThe directory that contains the user's program groups.
MyComputerThe "My Computer" folder.
NoteNote:
The MyComputer constant always yields the empty string ("") because no path is defined for the My Computer folder.
MyMusicThe "My Music" folder.
MyPicturesThe "My Pictures" folder.
RecentThe directory that contains the user's most recently used documents.
SendToThe directory that contains the Send To menu items.
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkStartMenuThe directory that contains the Start menu items.
Supported by the .NET Compact FrameworkSupported by the XNA FrameworkStartupThe directory that corresponds to the user's Startup program group.

The system starts these programs whenever a user logs on or starts Windows NT or later, or starts Windows 98.

SystemThe System directory.
TemplatesThe directory that serves as a common repository for document templates.
DesktopDirectoryThe directory used to physically store file objects on the desktop.

Do not confuse this directory with the desktop folder itself, which is a virtual folder.

Supported by the .NET Compact FrameworkSupported by the XNA FrameworkPersonalThe directory that serves as a common repository for documents.

This member is equivalent to MyDocuments.

MyDocumentsThe "My Documents" folder.

This member is equivalent to Personal.

ProgramFilesThe program files directory.
CommonProgramFilesThe directory for components that are shared across applications.

The system special folders are folders such as Program Files, Programs, System, or Startup, which contain common information. Special folders are set by default by the system, or explicitly by the user, when installing a version of Windows.

The GetFolderPath method returns the locations associated with this enumeration. The locations of these folders can have different values on different operating systems, the user can change some of the locations, and the locations are localized.

For more information about special folders, see the CSIDL values topic.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0

XNA Framework

Supported in: 2.0, 1.0

Reference

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Unsupported folders      Jason Stangroome ... Thomas Lee   |   Edit   |   Show History
This doesn't currently support querying for the SysWOW64 folder via CSIDL_SYSTEMx86 (0x29) or even FOLDERID_SystemX86 via the SHGetKnownFolderPath API in Vista. There are other special folders that aren't supported either, it will be interesting to see if this Enum gets extended or a new .NET wrapper altogether is provided.
Sample Using PowerShell      Thomas Lee   |   Edit   |   Show History
<#
.SYNOPSIS
This script lists the special folders enumerated in System.Environment.SpecialFolder
.DESCRIPTION
This script first enumerates the SpecialFolder Enum. for each member, the script
then looks up, and displays, the value of that folder.
.NOTES
File Name : Get-SpecialFolders.ps1
Author : Thomas Lee - tfl@psp.co.uk
Requires : PowerShell V2 CTP3
.LINK
This script posted to:
http://www.pshscripts.blogspot.com
MSDN Sample posted at:
http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx
.EXAMPLE
PSH [C:\foo]: . 'E:\PowerShellScriptLib\System.Environment\Get-SpecialFolders.PS1'
Folder Name Path
----------- -----------------------------------------------
Desktop C:\Users\tfl\Desktop
Programs C:\Users\tfl\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
Personal C:\Users\tfl\Documents
Personal C:\Users\tfl\Documents
Favorites C:\Users\tfl\NetHood\Favorites
Startup C:\Users\tfl\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Recent C:\Users\tfl\AppData\Roaming\Microsoft\Windows\Recent
SendTo C:\Users\tfl\AppData\Roaming\Microsoft\Windows\SendTo
StartMenu C:\Users\tfl\AppData\Roaming\Microsoft\Windows\Start Menu
MyMusic C:\Users\tfl\Music
DesktopDirectory C:\Users\tfl\Desktop
MyComputer
Templates C:\Users\tfl\AppData\Roaming\Microsoft\Windows\Templates
ApplicationData C:\Users\tfl\AppData\Roaming
LocalApplicationData C:\Users\tfl\AppData\Local
InternetCache C:\Users\tfl\AppData\Local\Microsoft\Windows\Temporary Internet Files
Cookies C:\Users\tfl\AppData\Roaming\Microsoft\Windows\Cookies
History C:\Users\tfl\AppData\Local\Microsoft\Windows\History
CommonApplicationData C:\ProgramData
System C:\Windows\system32
ProgramFiles C:\Program Files (x86)
MyPictures C:\Users\tfl\Pictures
CommonProgramFiles C:\Program Files (x86)\Common Files
#>
##
# Start of Script
##
# Get the list of special folders
$folders = [system.Enum]::GetValues([System.Environment+SpecialFolder])
# Display these folders
"Folder Name Path"
"----------- -----------------------------------------------"
foreach ($folder in $folders) {
"{0,-22} {1,-15}" -f $folder,[System.Environment]::GetFolderPath($folder)
}
# End of Script
Easier PowerShell Example      Ken Brubaker   |   Edit   |   Show History

You can get a specific folder with a single line in PowerShell. For example for Favorites do:


[System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::Favorites)
How to get the localized folder names?      IGBfA   |   Edit   |   Show History
From Vista onwards the paths of the special folders are in English for every(?) language version of Windows. (Personally I can speak for the German version.)

How to get the localized names displayed in Start menu --> All programs or Windows Explorer?
Processing
Page view tracker