This documentation is archived and is not being maintained.

My.Computer.FileSystem.CurrentDirectory Property 

Gets or sets the current directory.


' Usage
Dim value As String = My.Computer.FileSystem.CurrentDirectory
' Declaration
Public Property CurrentDirectory As String

String.

The following conditions may cause an exception:

CurrentDirectory is a system-wide environment variable.

This example returns the current directory and displays it in a message box.

MsgBox(My.Computer.FileSystem.CurrentDirectory)

This example sets the current directory to C:\TestDirectory.

My.Computer.FileSystem.CurrentDirectory = "C:\TestDirectory"

Namespace: Microsoft.VisualBasic.MyServices

Class: FileSystemProxy (provides access to FileSystem)

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

Availability by Project Type

Project type Available

Windows Application

Yes

Class Library

Yes

Console Application

Yes

Windows Control Library

Yes

Web Control Library

Yes

Windows Service

Yes

Web Site

Yes

Permissions may not be necessary to set CurrentDirectory.

The following permission may be necessary to read CurrentDirectory:

Permission Description

FileIOPermission

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

For more information, see Code Access Security and Requesting Permissions.

Show: