Assembly: mscorlib (in mscorlib.dll)
'Declaration Public Shared Property CurrentDirectory As String 'Usage Dim value As String value = Environment.CurrentDirectory Environment.CurrentDirectory = value
/** @property */ public static String get_CurrentDirectory () /** @property */ public static void set_CurrentDirectory (String value)
public static function get CurrentDirectory () : String public static function set CurrentDirectory (value : String)
Property ValueA string containing a directory path.
Attempted to set to an empty string ("").
Attempted to set to a null reference (Nothing in Visual Basic).
An I/O error occurred.
Attempted to set a local path that cannot be found.
The caller does not have the appropriate permission.
By definition, if this process starts in the root directory of a local or network drive, the value of this property is the drive name followed by a trailing slash (for example, "C:\"). If this process starts in a subdirectory, the value of this property is the drive and subdirectory path, without a trailing slash (for example, "C:\mySubDirectory").
The following code example demonstrates setting the CurrentDirectory property.
' Change the directory to %WINDIR% Environment.CurrentDirectory = Environment.GetEnvironmentVariable("windir") Dim info As New DirectoryInfo(".") Console.WriteLine(("Directory Info: " + info.FullName))
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.