Environment.SpecialFolder
Environment.SpecialFolder
Environment.SpecialFolder
Environment.SpecialFolder
Enum
Definition
Specifies enumerated constants used to retrieve directory paths to system special folders.
public: enum class Environment::SpecialFolder
[System.Runtime.InteropServices.ComVisible(true)]
public enum Environment.SpecialFolder
type Environment.SpecialFolder =
Public Enum Environment.SpecialFolder
- Inheritance
- Attributes
Fields
| AdminTools AdminTools AdminTools AdminTools | 48 | The 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. |
| ApplicationData ApplicationData ApplicationData ApplicationData | 26 | The directory that serves as a common repository for application-specific data for the current roaming user. |
| CDBurning CDBurning CDBurning CDBurning | 59 | The file system directory that acts as a staging area for files waiting to be written to a CD. Added in the .NET Framework 4. |
| CommonAdminTools CommonAdminTools CommonAdminTools CommonAdminTools | 47 | The file system directory that contains administrative tools for all users of the computer. Added in the .NET Framework 4. |
| CommonApplicationData CommonApplicationData CommonApplicationData CommonApplicationData | 35 | The directory that serves as a common repository for application-specific data that is used by all users. |
| CommonDesktopDirectory CommonDesktopDirectory CommonDesktopDirectory CommonDesktopDirectory | 25 | The 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. |
| CommonDocuments CommonDocuments CommonDocuments CommonDocuments | 46 | The 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. |
| CommonMusic CommonMusic CommonMusic CommonMusic | 53 | The file system directory that serves as a repository for music files common to all users. Added in the .NET Framework 4. |
| CommonOemLinks CommonOemLinks CommonOemLinks CommonOemLinks | 58 | This value is recognized in Windows Vista for backward compatibility, but the special folder itself is no longer used. Added in the .NET Framework 4. |
| CommonPictures CommonPictures CommonPictures CommonPictures | 54 | The file system directory that serves as a repository for image files common to all users. Added in the .NET Framework 4. |
| CommonProgramFiles CommonProgramFiles CommonProgramFiles CommonProgramFiles | 43 | The 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. |
| CommonProgramFilesX86 CommonProgramFilesX86 CommonProgramFilesX86 CommonProgramFilesX86 | 44 | The Program Files folder. Added in the .NET Framework 4. |
| CommonPrograms CommonPrograms CommonPrograms CommonPrograms | 23 | A 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. |
| CommonStartMenu CommonStartMenu CommonStartMenu CommonStartMenu | 22 | The 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. |
| CommonStartup CommonStartup CommonStartup CommonStartup | 24 | The 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. |
| CommonTemplates CommonTemplates CommonTemplates CommonTemplates | 45 | The 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. |
| CommonVideos CommonVideos CommonVideos CommonVideos | 55 | The file system directory that serves as a repository for video files common to all users. Added in the .NET Framework 4. |
| Cookies Cookies Cookies Cookies | 33 | The directory that serves as a common repository for Internet cookies. |
| Desktop Desktop Desktop Desktop | 0 | The logical Desktop rather than the physical file system location. |
| DesktopDirectory DesktopDirectory DesktopDirectory DesktopDirectory | 16 | The directory used to physically store file objects on the desktop. |
| Favorites Favorites Favorites Favorites | 6 | The directory that serves as a common repository for the user's favorite items. |
| Fonts Fonts Fonts Fonts | 20 | A virtual folder that contains fonts. Added in the .NET Framework 4. |
| History History History History | 34 | The directory that serves as a common repository for Internet history items. |
| InternetCache InternetCache InternetCache InternetCache | 32 | The directory that serves as a common repository for temporary Internet files. |
| LocalApplicationData LocalApplicationData LocalApplicationData LocalApplicationData | 28 | The directory that serves as a common repository for application-specific data that is used by the current, non-roaming user. |
| LocalizedResources LocalizedResources LocalizedResources LocalizedResources | 57 | The file system directory that contains localized resource data. Added in the .NET Framework 4. |
| MyComputer MyComputer MyComputer MyComputer | 17 | The My Computer folder. |
| MyDocuments MyDocuments MyDocuments MyDocuments | 5 | The My Documents folder. |
| MyMusic MyMusic MyMusic MyMusic | 13 | The My Music folder. |
| MyPictures MyPictures MyPictures MyPictures | 39 | The My Pictures folder. |
| MyVideos MyVideos MyVideos MyVideos | 14 | The file system directory that serves as a repository for videos that belong to a user. Added in the .NET Framework 4. |
| NetworkShortcuts NetworkShortcuts NetworkShortcuts NetworkShortcuts | 19 | A file system directory that contains the link objects that may exist in the My Network Places virtual folder. Added in the .NET Framework 4. |
| Personal Personal Personal Personal | 5 | The directory that serves as a common repository for documents. |
| PrinterShortcuts PrinterShortcuts PrinterShortcuts PrinterShortcuts | 27 | The file system directory that contains the link objects that can exist in the Printers virtual folder. Added in the .NET Framework 4. |
| ProgramFiles ProgramFiles ProgramFiles ProgramFiles | 38 | The program files directory. On a non-x86 system, passing ProgramFiles to the GetFolderPath(Environment+SpecialFolder) method returns the path for non-x86 programs. To get the x86 program files directory on a non-x86 system, use the ProgramFilesX86 member. |
| ProgramFilesX86 ProgramFilesX86 ProgramFilesX86 ProgramFilesX86 | 42 | The x86 Program Files folder. Added in the .NET Framework 4. |
| Programs Programs Programs Programs | 2 | The directory that contains the user's program groups. |
| Recent Recent Recent Recent | 8 | The directory that contains the user's most recently used documents. |
| Resources Resources Resources Resources | 56 | The file system directory that contains resource data. Added in the .NET Framework 4. |
| SendTo SendTo SendTo SendTo | 9 | The directory that contains the Send To menu items. |
| StartMenu StartMenu StartMenu StartMenu | 11 | The directory that contains the Start menu items. |
| Startup Startup Startup Startup | 7 | The directory that corresponds to the user's Startup program group. |
| System System System System | 37 | The System directory. |
| SystemX86 SystemX86 SystemX86 SystemX86 | 41 | The Windows System folder. Added in the .NET Framework 4. |
| Templates Templates Templates Templates | 21 | The directory that serves as a common repository for document templates. |
| UserProfile UserProfile UserProfile UserProfile | 40 | The 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. |
| Windows Windows Windows Windows | 36 | The Windows directory or SYSROOT. This corresponds to the %windir% or %SYSTEMROOT% environment variables. Added in the .NET Framework 4. |
Examples
The following example shows how to use Environment.SpecialFolder with the GetFolderPath method to get the System directory.
// Sample for the Environment::GetFolderPath method
using namespace System;
int main()
{
Console::WriteLine();
Console::WriteLine( "GetFolderPath: {0}", Environment::GetFolderPath( Environment::SpecialFolder::System ) );
}
/*
This example produces the following results:
GetFolderPath: C:\WINNT\System32
*/
// Sample for the Environment.GetFolderPath method
using System;
class Sample
{
public static void Main()
{
Console.WriteLine();
Console.WriteLine("GetFolderPath: {0}",
Environment.GetFolderPath(Environment.SpecialFolder.System));
}
}
/*
This example produces the following results:
GetFolderPath: C:\WINNT\System32
*/
' 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
'
Remarks
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.