MY.COMPUTER.FILESYSTEM.SPECIALDIRECTORIES

The My.Computer.FileSystem.SpecialDirectories property returns an object that has properties giving the locations of various special directories such as the system’s temporary directory and the user’s MyDocuments directory.

The following table describes these special directory properties.

PROPERTY PURPOSE
AllUsersApplicationData Application settings for all users
CurrentUserApplicationData Application settings for the current user
Desktop The current user’s desktop directory
MyDocuments The current user’s MyDocuments directory
MyMusic The current user’s MyMusic directory
MyPictures The current user’s MyPictures directory
Programs The current user’s Programs directory
ProgramFiles The current user’s Program Files directory
Temp The current user’s temporary directory
DIRECTORY DEFICIENCIES
Note that these directories may not all exist on a particular system. For example, a system may not define the MyMusic or MyPictures directories. Trying to access the value of a missing directory causes a DirectoryNotFoundException. You can use a Try Catch block to protect the program from the exception.

Get Visual Basic 2012 Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.