Function DriveGetType

Function Reference


DriveGetType

Returns drive type.

DriveGetType ( "path" [, operation = 1] )

Parameters

path Path of drive to receive information from.
operation [optional] The drive type operation to perform.
    $DT_DRIVETYPE (1) = the type of drive (default)
    $DT_SSDSTATUS (2) = SSD status of the drive
    $DT_BUSTYPE (3) = the bus type of drive

Constants are defined in AutoItConstants.au3.

Return Value

Success: See remarks.
Failure: Sets the @error flag to 1 if a bad path was given, or if the operation failed. Return value is "".

Remarks

If the mode parameter is $DT_DRIVETYPE (1), returns the type of drive. The path must be a string volume name, such as "C:\". Return values are:
"Unknown", "Removable", "Fixed", "Network", "CDROM", "RAMDisk"

If the mode parameter is $DT_SSDSTATUS (2), returns the SSD status of the drive. The path can be a string volume name, or an integer drive index. Return values are:
"SSD", "" (blank)

If the mode parameter is $DT_BUSTYPE (3), returns the bus type of the drive. The path can be a string volume name, or an integer drive index. Return values are:
"Unknown", "SCSI", "ATAPI", "ATA", "1394", "SSA", "Fibre", "USB", "RAID", "iSCSI", "SAS", "SATA", "SD", "MMC", "Virtual", "FileBackedVirtual"

Related

CDTray, DriveGetDrive, DriveGetFileSystem, DriveGetLabel, DriveGetSerial, DriveSetLabel, DriveSpaceFree, DriveSpaceTotal, DriveStatus

Example

#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>

; Check the drive type for C:\
Local $sInfo = DriveGetType("C:\")
MsgBox($MB_SYSTEMMODAL, "", "Drive Type: " & $sInfo)

; Check the SSD status for C:\
$sInfo = DriveGetType("C:\", $DT_SSDSTATUS)
MsgBox($MB_SYSTEMMODAL, "", "Drive SSD: " & $sInfo)

; Check the SSD status for disk 0
$sInfo = DriveGetType(0, $DT_SSDSTATUS)
MsgBox($MB_SYSTEMMODAL, "", "Drive SSD: " & $sInfo)

; Check the bus type status for disk 0
$sInfo = DriveGetType(0, $DT_BUSTYPE)
MsgBox($MB_SYSTEMMODAL, "", "Drive Bus: " & $sInfo)