aqFileSystem.Drives Property

Applies to TestComplete 15.31, last modified on March 17, 2022

Description

The Drives property returns an aqObjIterator object that lists all the disk drives of the computer (both local and network ones).

Declaration

aqFileSystem.Drives

Read-Only Property An aqObjIterator object

Applies To

The property is applied to the following object:

Property Value

The aqObjIterator object whose items are the aqDriveInfo objects that describe certain drive of the computer.

Example

The following script posts all assigned drive letters to the test log.

JavaScript, JScript

function DrivesExample()
{
  var drives = aqFileSystem.Drives;
 
  for (var i = 0; i < drives.Count; i++)
    Log.Message(drives(i).DriveLetter);
}

Python

def DrivesExample():
  drives = aqFileSystem.Drives
  for i in range(0, drives.Count):
    Log.Message(drives.Item(i).DriveLetter)

VBScript

Sub DrivesExample
  Dim colDrives, oDrive, i
  Set colDrives = aqFileSystem.Drives

  ' Access drives using the For Each enumerator
  For Each oDrive In colDrives
    Log.Message oDrive.DriveLetter
  Next

  ' Access drives using a loop
  For i = 0 to colDrives.Count - 1
    Log.Message colDrives(i).DriveLetter
  Next
End Sub

DelphiScript

procedure DrivesExample;
var drives, i;
begin
  drives := aqFileSystem.Drives;

  for i := 0 to drives.Count - 1 do
    Log.Message(drives.Item(i).DriveLetter);
end;

C++Script, C#Script

function DrivesExample()
{
  var drives = aqFileSystem["Drives"];
 
  for (var i = 0; i < drives["Count"]; i++)
    Log["Message"](drives(i)["DriveLetter"]);
}

See Also

Working With Files From Scripts
aqObjIterator Object
aqDriveInfo Object

Highlight search results