找回密码
 加入
搜索
查看: 5678|回复: 11

[网络通信] 请问AU3能否查询磁盘是否GPT分区吗?

  [复制链接]
发表于 2015-4-28 09:51:51 | 显示全部楼层 |阅读模式
请问AU3能否查询磁盘是否GPT分区吗?谢谢了,能否给出具体的例子
发表于 2015-4-28 12:04:05 | 显示全部楼层
回复 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

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2015-4-29 13:59:57 | 显示全部楼层
楼上正解~~~~
发表于 2015-4-29 14:00:07 | 显示全部楼层
楼上正解~~~~
发表于 2015-4-29 14:59:24 | 显示全部楼层
2楼正解~~~~
发表于 2015-4-30 09:14:41 | 显示全部楼层
2楼正解   好东西   收藏
 楼主| 发表于 2015-4-30 09:17:23 | 显示全部楼层
回复  木头人
参考
虫子樱桃 发表于 2015-4-28 12:04



    非常感谢。
 楼主| 发表于 2015-4-30 09:27:16 | 显示全部楼层
回复  木头人
参考
虫子樱桃 发表于 2015-4-28 12:04



    我运行不了脚本?请问是什么问题
发表于 2015-4-30 20:27:07 | 显示全部楼层
回复 8# 木头人


    Win7 Pro Sp1  AutoIt:10.3.12测试通过
发表于 2015-5-1 15:03:25 | 显示全部楼层
二楼正解..
发表于 2015-5-4 09:43:41 | 显示全部楼层
谢谢,,正需要啊,,,,找了很久
发表于 2020-5-31 10:26:34 | 显示全部楼层
win10 1909运行错误:
==> Variable must be of type "Object".:
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_DiskPartition", "WQL",$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
$colItems = $objWMIService^ ERROR
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-20 12:03 , Processed in 0.077735 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表