Drive Property

Applies to TestComplete 14.91, last modified on July 20, 2021

Description

The Drive property holds the name of the drive where the file is located.

Declaration

aqFileInfoObj.Drive

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

Applies To

The property is applied to the following object:

Property Value

A string containing the drive name.

Example

The code below demonstrates how to obtain the letter of the drive where the specified file resides.

JavaScript, JScript

function DriveExample()
{
  var sPath = "C:\\MyFiles\\FileName.txt";
  var FileInf = aqFileSystem.GetFileInfo(sPath);
  
  Log.Message(FileInf.Drive);
  
}

Python

def DriveExample():
  sPath = "C:\\MyFiles\\FileName.txt"
  FileInf = aqFileSystem.GetFileInfo(sPath)
  Log.Message(FileInf.Drive)

VBScript

Sub DriveExample

  sPath = "C:\MyFiles\FileName.txt"
  Set FileInf = aqFileSystem.GetFileInfo(sPath)
  
  Call Log.Message(FileInf.Drive)
  
End Sub

DelphiScript

function DriveExample;
var sPath, FileInfo;
begin

  sPath := 'C:\MyFiles\FileName.txt';
  FileInf := aqFileSystem.GetFileInfo(sPath);
  
  Log.Message(FileInf.Drive);
  
end;

C++Script, C#Script

function DriveExample()
{
  var sPath = "C:\\MyFiles\\FileName.txt";
  var FileInf = aqFileSystem["GetFileInfo"](sPath);
  
  Log["Message"]( FileInf["Drive"] );
  
}

See Also

Working With Files From Scripts
GetFileInfo Method
FindFiles Method
Name Property
Path Property

Highlight search results