FileSystem.CurDir Method

Definition

Returns a string representing the current path. The FileSystem gives you better productivity and performance in file I/O operations than CurDir. For more information, see CurrentDirectory.

Overloads

CurDir()

Returns a string representing the current path. The FileSystem gives you better productivity and performance in file I/O operations than CurDir. For more information, see CurrentDirectory.

CurDir(Char)

Returns a string representing the current path. The FileSystem gives you better productivity and performance in file I/O operations than CurDir. For more information, see CurrentDirectory.

CurDir()

Source:
FileSystem.vb
Source:
FileSystem.vb
Source:
FileSystem.vb

Returns a string representing the current path. The FileSystem gives you better productivity and performance in file I/O operations than CurDir. For more information, see CurrentDirectory.

C#
public static string CurDir();

Returns

A string representing the current path.

Examples

This example uses the CurDir function to return the current path.

VB
' Assume current path on C drive is "C:\WINDOWS\SYSTEM".
' Assume current path on D drive is "D:\EXCEL".
' Assume C is the current drive.
Dim MyPath As String
MyPath = CurDir()   ' Returns "C:\WINDOWS\SYSTEM".
MyPath = CurDir("C"c)   ' Returns "C:\WINDOWS\SYSTEM".
MyPath = CurDir("D"c)   ' Returns "D:\EXCEL".

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

CurDir(Char)

Source:
FileSystem.vb
Source:
FileSystem.vb
Source:
FileSystem.vb

Returns a string representing the current path. The FileSystem gives you better productivity and performance in file I/O operations than CurDir. For more information, see CurrentDirectory.

C#
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static string CurDir(char Drive);
C#
public static string CurDir(char Drive);

Parameters

Drive
Char

Optional. Char expression that specifies an existing drive. If no drive is specified, or if Drive is a zero-length string (""), CurDir returns the path for the current drive.

Returns

A string representing the current path.

Attributes

Examples

This example uses the CurDir function to return the current path.

VB
' Assume current path on C drive is "C:\WINDOWS\SYSTEM".
' Assume current path on D drive is "D:\EXCEL".
' Assume C is the current drive.
Dim MyPath As String
MyPath = CurDir()   ' Returns "C:\WINDOWS\SYSTEM".
MyPath = CurDir("C"c)   ' Returns "C:\WINDOWS\SYSTEM".
MyPath = CurDir("D"c)   ' Returns "D:\EXCEL".

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1