回复 1# 木头人
参考; 生成于虫子樱桃自用汉化版 AutoIt Scriptomatic
__wmi_Win32_DiskPartition()
Func __wmi_Win32_DiskPartition()
Local $wbemFlagReturnImmediately = 0x10
Local $wbemFlagForwardOnly = 0x20
Local $colItems = ""
Local $strComputer = "localhost"
Local $Output=""
$Output &= "Computer: " & $strComputer & @CRLF
$Output &= "==========================================" & @CRLF
Local $objWMIService = ObjGet("winmgmts:\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_DiskPartition", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
For $objItem In $colItems
$Output &= "Access: " & $objItem.Access & @CRLF
$Output &= "Availability: " & $objItem.Availability & @CRLF
$Output &= "BlockSize: " & $objItem.BlockSize & @CRLF
$Output &= "Bootable: " & $objItem.Bootable & @CRLF
$Output &= "BootPartition: " & $objItem.BootPartition & @CRLF
$Output &= "Caption: " & $objItem.Caption & @CRLF
$Output &= "ConfigManagerErrorCode: " & $objItem.ConfigManagerErrorCode & @CRLF
$Output &= "ConfigManagerUserConfig: " & $objItem.ConfigManagerUserConfig & @CRLF
$Output &= "CreationClassName: " & $objItem.CreationClassName & @CRLF
$Output &= "Description: " & $objItem.Description & @CRLF
$Output &= "DeviceID: " & $objItem.DeviceID & @CRLF
$Output &= "DiskIndex: " & $objItem.DiskIndex & @CRLF
$Output &= "ErrorCleared: " & $objItem.ErrorCleared & @CRLF
$Output &= "ErrorDescription: " & $objItem.ErrorDescription & @CRLF
$Output &= "ErrorMethodology: " & $objItem.ErrorMethodology & @CRLF
$Output &= "HiddenSectors: " & $objItem.HiddenSectors & @CRLF
$Output &= "Index: " & $objItem.Index & @CRLF
$Output &= "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
$Output &= "LastErrorCode: " & $objItem.LastErrorCode & @CRLF
$Output &= "Name: " & $objItem.Name & @CRLF
$Output &= "NumberOfBlocks: " & $objItem.NumberOfBlocks & @CRLF
$Output &= "PNPDeviceID: " & $objItem.PNPDeviceID & @CRLF
Local $strPowerManagementCapabilities = $objItem.PowerManagementCapabilities(0)
$Output &= "PowerManagementCapabilities: " & $strPowerManagementCapabilities & @CRLF
$Output &= "PowerManagementSupported: " & $objItem.PowerManagementSupported & @CRLF
$Output &= "PrimaryPartition: " & $objItem.PrimaryPartition & @CRLF
$Output &= "Purpose: " & $objItem.Purpose & @CRLF
$Output &= "RewritePartition: " & $objItem.RewritePartition & @CRLF
$Output &= "Size: " & $objItem.Size & @CRLF
$Output &= "StartingOffset: " & $objItem.StartingOffset & @CRLF
$Output &= "Status: " & $objItem.Status & @CRLF
$Output &= "StatusInfo: " & $objItem.StatusInfo & @CRLF
$Output &= "SystemCreationClassName: " & $objItem.SystemCreationClassName & @CRLF
$Output &= "SystemName: " & $objItem.SystemName & @CRLF
$Output &= "Type: " & $objItem.Type & @CRLF
if Msgbox(1,"WMI输出",$Output) = 2 then ExitLoop
$Output=""
Next
Else
Msgbox(0,"WMI 输出","没有在类 " & "Win32_DiskPartition" & "中找到WMI对象" )
Endif
EndFunc
Func WMIDateStringToDate($dtmDate)
Return (StringMid($dtmDate, 5, 2) & "/" & _
StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
& " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
EndFunc
|