SpecialDirectories.ProgramFiles Property

 

Gets a path pointing to the Program Files directory.

Namespace:   Microsoft.VisualBasic.FileIO
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

public static string ProgramFiles { get; }

Property Value

Type: System.String

The path to the Program Files directory.

Exception Condition
DirectoryNotFoundException

The path is empty, usually because the operating system does not support the directory.

The SpecialDirectories object contains paths to commonly referenced directories. The Program Files directory contains the computer's program files.

This example displays the path for the Program Files directory in a MessageBox.

MsgBox(My.Computer.FileSystem.SpecialDirectories.ProgramFiles)

EnvironmentPermission

Controls access to system and user environment variables. Associated enumeration: Unrestricted.

FileIOPermission

Controls the ability to access files and folders. Associated enumeration: Unrestricted.

.NET Framework
Available since 2.0
Return to top
Show: