FileSystem.CurDir 方法

定义

返回表示当前路径的字符串。 这 FileSystem 比在文件 I/O 操作 CurDir中提供更好的工作效率和性能。 有关详细信息,请参阅 CurrentDirectory

重载

名称 说明
CurDir()

返回表示当前路径的字符串。 这 FileSystem 比在文件 I/O 操作 CurDir中提供更好的工作效率和性能。 有关详细信息,请参阅 CurrentDirectory

CurDir(Char)

返回表示当前路径的字符串。 这 FileSystem 比在文件 I/O 操作 CurDir中提供更好的工作效率和性能。 有关详细信息,请参阅 CurrentDirectory

CurDir()

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

返回表示当前路径的字符串。 这 FileSystem 比在文件 I/O 操作 CurDir中提供更好的工作效率和性能。 有关详细信息,请参阅 CurrentDirectory

public:
 static System::String ^ CurDir();
public static string CurDir();
static member CurDir : unit -> string
Public Function CurDir () As String

返回

表示当前路径的字符串。

示例

此示例使用 CurDir 函数返回当前路径。

' 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".

另请参阅

适用于

CurDir(Char)

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

返回表示当前路径的字符串。 这 FileSystem 比在文件 I/O 操作 CurDir中提供更好的工作效率和性能。 有关详细信息,请参阅 CurrentDirectory

public:
 static System::String ^ CurDir(char Drive);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static string CurDir(char Drive);
public static string CurDir(char Drive);
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member CurDir : char -> string
static member CurDir : char -> string
Public Function CurDir (Drive As Char) As String

参数

Drive
Char

Optional. Char 指定现有驱动器的表达式。 如果未指定驱动器,或者是否 Drive 为零长度字符串(“), CurDir 则返回当前驱动器的路径。

返回

表示当前路径的字符串。

属性

示例

此示例使用 CurDir 函数返回当前路径。

' 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".

另请参阅

适用于