ClassSystem.IO.Directory SyntaxDim result( ) As String = Directory.GetLogicalDrives ( ) DescriptionThe GetLogicalDrives method returns an array of strings, with each element containing the root directory of each logical drive on the local system. Usage at a GlanceIn the case of a mapped network drive, GetLogicalDrives returns the letter to which the drive is mapped. For instance, if the directory \\SomeServer\C\SomeFolder is mapped to the "Z" drive, then GetLogicalDrives will return "Z:\" for this logical drive. ExampleDim allDrives( ) As String Dim counter As Integer allDrives = Directory.GetLogicalDrives( ) For counter = 0 To UBound(allDrives) Console.WriteLine(allDrives(counter)) Next counter Typical output for this code looks like the following: A:\ C:\ D:\ E:\ F:\ G:\ Version DifferencesVisual Basic 2005 includes a My.Computer.FileSystem.Drives property that provides similar functionality. |