CurrentDirectory Property
Collapse the table of content
Expand the table of content

FileSystem.CurrentDirectory Property


Gets or sets the current directory.

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

public static string CurrentDirectory { get; set; }

Property Value

Type: System.String

The current directory for file I/O operations.

Exception Condition

The path is not valid.


The user lacks necessary permissions.

CurrentDirectory is a system-wide environment variable.

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


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

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


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

.NET Framework
Available since 2.0
Return to top
© 2016 Microsoft