Get Special Folder Location using System.Environment in C#

System Special Folders

System folders are folders such as “Program Files”, “Start Menu” or “System”, which are used to store common information. These folders are set by default by the system, in some cases explicitly defined by the user, when installing operating system. The locations of these directories can be different for different operating systems, locations are localized and user can change some of the locations.

Environment.SpecialFolder enumeration in System namespace defines enumerated constants used to retrieve directory paths to system special folders.

Some of the constants defined in Environment.SpecialFolder enumeration are list below. For a complete list, please refer to Microsft.NET documentation.

Folder Name



The program files folder where programs are usually installed.


The Common Files folder of Program Files


The folder representing the desktop of the User.


The favorite’s folder to store favorite’s link.


The history folder to store history files


The MyDocuments folder.


The folder representing Programs Menu in the Start Menu.


The folder of the start menu.


The recent folder.


The Send To folder


The System folder of the machine.


The application data folder.


The Common Application Data Folder.


The Local Application Data Folder.


The folder used to store cookies settings.


The startUp Menu Folder on the start >> programs folder.


Getting Folder Location

The GetFolderPath static method of Environment class returns the locations associated with SpecialFolder enumeration.

The overloaded GetFolderPath takes SpecialFolderOption enum as additional parameter.

SpecialFolderOption has following enumeration constants.

  • Create - Path of the folder is created if it not existing.
  • DoNotVerify  - Just returns path, existence of path is not verified. Useful in case of network paths, reduces lag time
  • None - Path of the folder is verified, if exists path is returned, if not exists empty string is returned.

The following code snippet demonstrates how we can get the information related to the folders mentioned in the above table.

// Get Program Files location.
string programfiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);

// Get Common Program Files location.
string commonProgramfiles = Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles, Environment.SpecialFolderOption.None);