FileSystem.GetParentPath(String) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
回傳所提供路徑的父路徑。
public:
static System::String ^ GetParentPath(System::String ^ path);
public static string GetParentPath(string path);
static member GetParentPath : string -> string
Public Shared Function GetParentPath (path As String) As String
參數
- path
- String
需要檢視的道路。
傳回
所提供路徑的父路徑。
例外狀況
路徑沒有父路徑,因為它是根路徑。
path 是 Nothing。
路徑超過系統定義的最大長度。
路徑中的檔案或目錄名稱包含冒號(:),或格式無效。
範例
此範例得到 的 C:\Backups\Tmp\Test父路徑。
Dim strPath = My.Computer.FileSystem.GetParentPath("C:\backups\tmp\test")
MsgBox(strPath)
備註
這是一個字串運算;檔案系統不會被檢查。