Home  |  Delphi .net Home  |  System.Environment  |  GetLogicalDrives Method
  
GetLogicalDrives  
Method  
Gets the names of the logical device drives on the current machine
Environment Class
System NameSpace
NotCF1.  Function GetLogicalDrives : Array of String; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
Returns an array of strings containing the drive designations in the form :
 
L:\
 
Where L is the letter of the drive, such as A, B, C and so on.
Microsoft MSDN Links
System
System.Environment
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

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

var
  drives : Array of String;
  i      : Integer;

begin
  drives := System.Environment.GetLogicalDrives;

  for i := 0 to Length(drives)-1 do
    Console.WriteLine('Drive {0} = {1}', i.ToString, drives[i]);

  Console.ReadLine;
end.
   Drive 0 = A:\
   Drive 1 = C:\
   Drive 2 = D:\
   Drive 3 = E:\
   Drive 4 = F:\
   Drive 5 = G:\
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author