FileSystem.CurDir 方法

定義

回傳一個代表當前路徑的字串。 這 FileSystem 比 . 在檔案 I/O 操作 CurDir中提供更好的生產力和效能。 如需詳細資訊,請參閱CurrentDirectory

多載

名稱 Description
CurDir()

回傳一個代表當前路徑的字串。 這 FileSystem 比 . 在檔案 I/O 操作 CurDir中提供更好的生產力和效能。 如需詳細資訊,請參閱CurrentDirectory

CurDir(Char)

回傳一個代表當前路徑的字串。 這 FileSystem 比 . 在檔案 I/O 操作 CurDir中提供更好的生產力和效能。 如需詳細資訊,請參閱CurrentDirectory

CurDir()

回傳一個代表當前路徑的字串。 這 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)

回傳一個代表當前路徑的字串。 這 FileSystem 比 . 在檔案 I/O 操作 CurDir中提供更好的生產力和效能。 如需詳細資訊,請參閱CurrentDirectory

public:
 static System::String ^ CurDir(char Drive);
public static string CurDir(char Drive);
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".

另請參閱

適用於