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.

ExceptionCondition
DirectoryNotFoundException

The path is not valid.

UnauthorizedAccessException

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.

MsgBox(My.Computer.FileSystem.CurrentDirectory)

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

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft