;
MsgBox(0,"test",_DiskList())
Func _DiskList()
;功能:返回硬盘列表,以|为分隔
;说明:www.autoitx.com 版权所有
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"
$Output=""
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
For $objItem In $colItems
$Output&=$objItem.Model&"|"
;硬盘列表
;$Output&=$objItem.Model&chr(32)&"("&int($objItem.Size/1000/1000/1000)&chr(32)&"GB"&")"&"|"
;硬盘列表加硬盘大小
Next
Return $Output
EndIf
EndFunc
|