检索指定驱动器的类型、编号、分区号.
#Include <WinAPIEx.au3>
_WinAPI_GetDriveNumber ( $sDrive )
$sDrive | 驱动器号,如 D:, E:, 等等. |
成功: | 返回 $tagSTORAGE_DEVICE_NUMBER 结构,包含相关信息. |
失败: | 返回 0,并设置@error标志为非 0 值. |
在MSDN中搜索
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $Data, $Drive = DriveGetDrive('FIXED')
Global $List[10]
For $i = 0 To UBound($Drive) - 1
$List[$i] = ''
Next
If IsArray($Drive) Then
For $i = 1 To $Drive[0]
$Data = _WinAPI_GetDriveNumber($Drive[$i])
If IsArray($Data) Then
$List[$Data[1]] &= StringUpper($Drive[$i]) & ' '
EndIf
Next
EndIf
For $i = 0 To UBound($Drive) - 1
If $List[$i] Then
ConsoleWrite('Drive' & $i & ' => ' & $List[$i] & @CR)
EndIf
Next