Sub Main()
' 「\」が区切り文字
Dim path1 As String = "c:\windows\system32\notepad.exe"
Dim dir1 As String = Path.GetDirectoryName(path1)
Console.WriteLine(dir1)
' 出力例:c:\windows\system32
' 「/」が区切り文字
Dim path2 As String = "http://www.atmarkit.co.jp/fdotnet/index.html"
Dim dir2 As String = Path.GetDirectoryName(path2)
Console.WriteLine(dir2)
' 出力例:http:\www.atmarkit.co.jp\fdotnet
' ドライブ名に続く「:」が区切り文字
Dim path3 As String = "c:notepad.exe"
Dim dir3 As String = Path.GetDirectoryName(path3)
Console.WriteLine(dir3)
' 出力例:c:
End Sub