FileSystem.GetName(String) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
從提供的路徑中解析檔名。
public:
static System::String ^ GetName(System::String ^ path);
public static string GetName(string path);
static member GetName : string -> string
Public Shared Function GetName (path As String) As String
參數
- path
- String
必須的。 路徑待解析。
String。
傳回
指定路徑的檔名。
範例
以下範例解析一個檔案路徑並回傳檔案名稱。
MsgBox("The filename is: " &
My.Computer.FileSystem.GetName("C:\testdirectory\testfile"))
用你想解析的路徑替換路徑 C:\Testdirectory\Testfile 。
備註
這是一個字串運算; FileSystem 未被檢視。
此 GetName 方法忽略路徑末端的斜線。
下表列出一個涉及此 My.Computer.FileSystem.GetFileName 方法的任務範例。
| 至 | 看! |
|---|---|
| 解析檔案路徑 |