请问AU3能否查询磁盘是否GPT分区吗?
请问AU3能否查询磁盘是否GPT分区吗?谢谢了,能否给出具体的例子 回复 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 楼上正解~~~~ 楼上正解~~~~ 2楼正解~~~~ 2楼正解 好东西 收藏 回复木头人
参考
虫子樱桃 发表于 2015-4-28 12:04 http://autoitx.com/images/common/back.gif
非常感谢。 回复木头人
参考
虫子樱桃 发表于 2015-4-28 12:04 http://autoitx.com/images/common/back.gif
我运行不了脚本?请问是什么问题 回复 8# 木头人
Win7 Pro Sp1AutoIt:10.3.12测试通过 二楼正解.. 谢谢,,正需要啊,,,,找了很久 win10 1909运行错误:
==> Variable must be of type "Object".:
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_DiskPartition", "WQL",$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
$colItems = $objWMIService^ ERROR
页:
[1]