Share via


FileSystem.CurDir 方法

定義

傳回表示目前路徑的字串。 FileSystem 提供比 CurDir 更優越的檔案 I/O 作業產能和效能。 如需詳細資訊,請參閱CurrentDirectory

多載

CurDir()

傳回表示目前路徑的字串。 FileSystem 提供比 CurDir 更優越的檔案 I/O 作業產能和效能。 如需詳細資訊,請參閱CurrentDirectory

CurDir(Char)

傳回表示目前路徑的字串。 FileSystem 提供比 CurDir 更優越的檔案 I/O 作業產能和效能。 如需詳細資訊,請參閱CurrentDirectory

CurDir()

來源:
FileSystem.vb
來源:
FileSystem.vb
來源:
FileSystem.vb

傳回表示目前路徑的字串。 FileSystem 提供比 CurDir 更優越的檔案 I/O 作業產能和效能。 如需詳細資訊,請參閱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)

來源:
FileSystem.vb
來源:
FileSystem.vb
來源:
FileSystem.vb

傳回表示目前路徑的字串。 FileSystem 提供比 CurDir 更優越的檔案 I/O 作業產能和效能。 如需詳細資訊,請參閱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

選擇性。 指定現有磁碟機的 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".

另請參閱

適用於