FileSystem.CurDir 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
回傳一個代表當前路徑的字串。 這 FileSystem 比 . 在檔案 I/O 操作 CurDir中提供更好的生產力和效能。 如需詳細資訊,請參閱CurrentDirectory。
多載
| 名稱 | Description |
|---|---|
| CurDir() |
回傳一個代表當前路徑的字串。 這 FileSystem 比 . 在檔案 I/O 操作 |
| CurDir(Char) |
回傳一個代表當前路徑的字串。 這 FileSystem 比 . 在檔案 I/O 操作 |
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".