FileSystemProxy.GetParentPath(String) 方法

定義

傳回提供之路徑的父路徑。

public:
 System::String ^ GetParentPath(System::String ^ path);
public string GetParentPath (string path);
member this.GetParentPath : string -> string
Public Function GetParentPath (path As String) As String

參數

path
String

要檢查的路徑。

傳回

所提供之路徑的父路徑。

例外狀況

路徑沒有父路徑,因為它是根路徑。

pathNothing

路徑超過系統定義的最大長度。

路徑中的檔案或目錄名稱含有冒號 (:),或者是無效的格式。

範例

這個範例會取得 的 C:\Backups\Tmp\Test父路徑。

Dim strPath = My.Computer.FileSystem.GetParentPath("C:\backups\tmp\test")
MsgBox(strPath)

備註

這是字串作業;不會檢查檔案系統。

適用於

另請參閱