Returns the volume information, root information, or both for the specified path.
Imports System
Imports System.IO
Public Class DirectoryRoot
Public Shared Sub Main()
Dim dir As String = "C:\test"
Try
Directory.SetCurrentDirectory(dir)
Catch e As DirectoryNotFoundException
Console.WriteLine("The specified directory does not exist. {0}", e)
End Try
Console.WriteLine("Root directory: {0}", Directory.GetDirectoryRoot(dir))
Console.WriteLine("Current directory: {0}", Directory.GetCurrentDirectory())
End Sub
End Class
Related examples in the same category