DriveExists Method

 

Description

 

Returns True if the specified drive exists; False if it does not.

 

PowerBASIC Syntax

 

METHOD DriveExists ( _

BYVAL bstrDriveSpec AS STRING _

) AS INTEGER

 

Arguments

 

bstrDriveSpec

BSTR. A drive letter or a complete path specification.

 

Return Value

 

Boolean. VARIANT_TRUE or VARIANT_FALSE.

 

Remarks

 

For drives with removable media, the DriveExists method returns true even if there are no media present. Use the IsReady property of the IDrive interface to determine if a drive is ready.

 

Example [PowerBASIC]

 

#INCLUDE "windows.inc"

#INCLUDE "scrrun.inc"

 

DIM fso AS IFileSystem

DIM iExists AS INTEGER

 

' Create an instance of the FileSystemObject

fso = NEWCOM "Scripting.FileSystemObject"

' Check if the drive exists

iExists = fso.DriveExists(UCODE$("C:"))

 

Valid XHTML 1.0 Transitional