EnvironmentGetFolderPath Method (EnvironmentSpecialFolder, EnvironmentSpecialFolderOption) |
Gets the path to the system special folder that is identified by the specified enumeration, and uses a specified option for accessing special folders.
Namespace: SystemAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public static string GetFolderPath(
EnvironmentSpecialFolder folder,
EnvironmentSpecialFolderOption option
)
Parameters
- folder
- Type: SystemEnvironmentSpecialFolder
An enumerated constant that identifies a system special folder. - option
- Type: SystemEnvironmentSpecialFolderOption
Specifies options to use for accessing a special folder.
Return Value
Type:
StringThe path to the specified system special folder, if that folder physically exists on your computer; otherwise, an empty string ("").A folder will not physically exist if the operating system did not create it, the existing folder was deleted, or the folder is a virtual directory, such as My Computer, which does not correspond to a physical path.
Exceptions Exception | Condition |
---|
ArgumentException | folder is not a member of EnvironmentSpecialFolder |
PlatformNotSupportedException | PlatformNotSupportedException |
See Also