Export (0) Print
Expand All
Expand Minimize

Environment.SpecialFolder Enumeration

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

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
<ComVisibleAttribute(True)> _
Public Enumeration SpecialFolder

Member nameDescription
AdminToolsThe file system directory that is used to store administrative tools for an individual user. The Microsoft Management Console (MMC) will save customized consoles to this directory, and it will roam with the user. Added in the .NET Framework 4.
Supported 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.

CDBurningThe file system directory that acts as a staging area for files waiting to be written to a CD. Added in the .NET Framework 4.
CommonAdminToolsThe file system directory that contains administrative tools for all users of the computer. Added in the .NET Framework 4.
CommonApplicationDataThe directory that serves as a common repository for application-specific data that is used by all users.
CommonDesktopDirectoryThe file system directory that contains files and folders that appear on the desktop for all users. This special folder is valid only for Windows NT systems. Added in the .NET Framework 4.
CommonDocumentsThe file system directory that contains documents that are common to all users. This special folder is valid for Windows NT systems, Windows 95, and Windows 98 systems with Shfolder.dll installed. Added in the .NET Framework 4.
CommonMusicThe file system directory that serves as a repository for music files common to all users. Added in the .NET Framework 4.
CommonOemLinksThis value is recognized in Windows Vista for backward compatibility, but the special folder itself is no longer used. Added in the .NET Framework 4.
CommonPicturesThe file system directory that serves as a repository for image files common to all users. Added in the .NET Framework 4.
CommonProgramFilesThe directory for components that are shared across applications.To get the x86 common program files directory on a non-x86 system, use the ProgramFilesX86 member.
CommonProgramFilesX86The Program Files folder. Added in the .NET Framework 4.
CommonProgramsA folder for components that are shared across applications. This special folder is valid only for Windows NT, Windows 2000, and Windows XP systems. Added in the .NET Framework 4.
CommonStartMenuThe file system directory that contains the programs and folders that appear on the Start menu for all users. This special folder is valid only for Windows NT systems. Added in the .NET Framework 4.
CommonStartupThe file system directory that contains the programs that appear in the Startup folder for all users. This special folder is valid only for Windows NT systems. Added in the .NET Framework 4.
CommonTemplatesThe file system directory that contains the templates that are available to all users. This special folder is valid only for Windows NT systems. Added in the .NET Framework 4.
CommonVideosThe file system directory that serves as a repository for video files common to all users. Added in the .NET Framework 4.
CookiesThe directory that serves as a common repository for Internet cookies.
DesktopThe logical Desktop rather than the physical file system location.
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 XNA FrameworkFavoritesThe directory that serves as a common repository for the user's favorite items.
FontsA virtual folder that contains fonts. Added in the .NET Framework 4.
HistoryThe directory that serves as a common repository for Internet history items.
InternetCacheThe directory that serves as a common repository for temporary Internet files.
LocalApplicationDataThe directory that serves as a common repository for application-specific data that is used by the current, non-roaming user.
LocalizedResourcesThe file system directory that contains localized resource data. Added in the .NET Framework 4.
MyComputerThe My Computer folder.

The MyComputer constant always yields the empty string ("") because no path is defined for the My Computer folder.

MyDocumentsThe My Documents folder.

This member is equivalent to Personal.

MyMusicThe My Music folder.
MyPicturesThe My Pictures folder.
MyVideosThe file system directory that serves as a repository for videos that belong to a user. Added in the .NET Framework 4.
NetworkShortcutsA file system directory that contains the link objects that may exist in the My Network Places virtual folder. Added in the .NET Framework 4.
Supported by the XNA FrameworkPersonalThe directory that serves as a common repository for documents.

This member is equivalent to MyDocuments.

PrinterShortcutsThe file system directory that contains the link objects that can exist in the Printers virtual folder. Added in the .NET Framework 4.
ProgramFilesThe program files directory.On a non-x86 system, passing ProgramFiles to the GetFolderPath method returns the path for non-x86 programs. To get the x86 program files directory on a non-x86 system, use the ProgramFilesX86 member.
ProgramFilesX86The Program Files folder. Added in the .NET Framework 4. On an x86 system, passing the ProgramFilesX86 member to the Environment.GetFolderPath method returns String.Empty; use the ProgramFiles member instead. You can determine whether Windows is a 32-bit operating system by calling the Environment.Is64BitOperatingSystem property.
Supported by the XNA FrameworkProgramsThe directory that contains the user's program groups.
RecentThe directory that contains the user's most recently used documents.
ResourcesThe file system directory that contains resource data. Added in the .NET Framework 4.
SendToThe directory that contains the Send To menu items.
Supported by the XNA FrameworkStartMenuThe directory that contains the Start menu items.
Supported 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.
SystemX86The Windows System folder. Added in the .NET Framework 4.
TemplatesThe directory that serves as a common repository for document templates.
UserProfileThe user's profile folder. Applications should not create files or folders at this level; they should put their data under the locations referred to by ApplicationData. Added in the .NET Framework 4.
WindowsThe Windows directory or SYSROOT. This corresponds to the %windir% or %SYSTEMROOT% environment variables. Added in the .NET Framework 4.

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 KNOWNFOLDERID constants in the Windows documentation.

The following example shows how to use Environment.SpecialFolder with the GetFolderPath method to get the System directory.

' Sample for the Environment.GetFolderPath method 
Imports System

Class Sample
   Public Shared Sub Main()
      Console.WriteLine()
      Console.WriteLine("GetFolderPath: {0}", Environment.GetFolderPath(Environment.SpecialFolder.System))
   End Sub 'Main
End Class 'Sample

'This example produces the following results: 

'GetFolderPath: C:\WINNT\System32 
'

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft