FileSystem.GetParentPath(String) メソッド

定義

指定されたパスの親パスを返します。

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

確認するパス。

戻り値

指定されたパスの親パス。

例外

パスがルート パスであるため、親パスが存在しません。

pathNothingです。

パスがシステム定義の最大長を超えています。

パス内のファイル名またはディレクトリ名にコロン (:) が含まれているか、形式が無効です。

この例では、 の親パスを取得します C:\Backups\Tmp\Test

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

注釈

これは文字列操作です。ファイル システムは検査されません。

適用対象