DriveLetter Property

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

Use the DriveLetter property to get the letter that corresponds to the given drive.

Declaration

aqDriveInfoObj.DriveLetter

Read-Only Property String
aqDriveInfoObj An expression, variable or parameter that specifies a reference to an aqDriveInfo object

Applies To

The property is applied to the following object:

Property Value

The letter that corresponds to the given drive.

Example

The code below demonstrates how you can obtain the letters of all the drives installed on your computer.

JavaScript, JScript

function DriveLettersExample()
{
 for (var i = 0; i != aqFileSystem.Drives.Count; i++)
  Log.Message(aqFileSystem.Drives.Item(i).DriveLetter);
}

Python

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

VBScript

Sub DriveLettersExample
 Dim i
  For i = 0 to aqFileSystem.Drives.Count - 1
 Call Log.Message(aqFileSystem.Drives.Item(i).DriveLetter)
 Next
End Sub

DelphiScript

function DriveLettersExample;
var i: integer;
begin
 for i :=0 to aqFileSystem.Drives.Count-1 do
  Log.Message(aqFileSystem.Drives.Item(i).DriveLetter);
end;

C++Script, C#Script

function DriveLettersExample()
{
 for (var i = 0; i != aqFileSystem["Drives"]["Count"]; i++)
  Log["Message"]( aqFileSystem["Drives"]["Item"](i)["DriveLetter"] );
}

See Also

Working With Files From Scripts
GetDriveInfo Method
SerialNumber Property

Highlight search results