Home  |  Delphi .net Home  |  System.IO.Directory  |  GetLogicalDrives Method
  
GetLogicalDrives  
Method  
Gets the names of the Logical Drives on the current machine
Directory Class
System.IO NameSpace
NotCF1.  Function GetLogicalDrives : Array of String; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
If the current machine recognises the concept of logical drives (some devices do not), then a list is returned, where each drive has the following format :
 
"#:\"
 
Where # is a drive letter : A, B, C ... .
 
See the code for the drives on the author's machine.
Notes
Static methods are not methods of an object - they are simply class functions or procedures available at any time.
Microsoft MSDN Links
System.IO
System.IO.Directory
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

uses
  System.IO;

var
  Drives : Array of String;
  i      : Integer;

begin
  // Get the logical drives on this machine
  Drives := System.IO.Directory.GetLogicalDrives;

  // Display them
  for i := 0 to Length(Drives)-1 do
    Console.WriteLine(Drives[i]);

  Console.Readline;
end.
   A:\
   C:\
   D:\
   E:\
   F:\
   G:\
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author