函数参考


DriveGetDrive

返回一个含有指定驱动器盘符的数组.

DriveGetDrive ( "类型" )

参数

类型 要获得的驱动器类型:
"ALL(全部)", "CDROM(光驱)", "REMOVABLE(可移动驱动器)", "FIXED(固定驱动器)", "NETWORK(网络驱动器)", "RAMDISK(内存盘)", or "UNKNOWN(未知类型)"

返回值

成功: 以字符串数组的形式返回所找到的驱动器的盘符(驱动器盘符后接一个冒号).数组中的0号元素储存驱动器的数量.
失败: 返回 "" (空字符串),并把 @error 设为 1.

注意/说明

None.

相关

DriveGetFileSystem, DriveGetLabel, DriveGetSerial, DriveGetType, DriveSetLabel, DriveSpaceFree, DriveSpaceTotal, DriveStatus

示例/演示


Local $aArray = DriveGetDrive("ALL")
If @error Then
    ; An error occurred when retrieving the drives.
    MsgBox(4096, "DriveGetDrive", "It appears an error occurred.")
Else
    For $i = 1 To $aArray[0]
        ; Show all the drives found and convert the drive letter to uppercase.
        MsgBox(4096, "DriveGetDrive", "Drive " & $i & "/" & $aArray[0] & ":" & @CRLF & StringUpper($aArray[$i]))
    Next
EndIf