找回密码
 加入
搜索
查看: 1975|回复: 5

请教一下如何取得磁盘的VolumeName

[复制链接]
发表于 2008-7-13 10:56:22 | 显示全部楼层 |阅读模式
如题,小弟虚心求教.

[ 本帖最后由 ceoguang 于 2008-7-13 21:20 编辑 ]
发表于 2008-7-13 17:18:46 | 显示全部楼层
[au3]; 生成于 AutoIt Scriptomatic

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"

$Output=""
$Output = $Output & "Computer: " & $strComputer  & @CRLF
$Output = $Output & "==========================================" & @CRLF
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_MountPoint", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
   For $objItem In $colItems
      $Output = $Output & "Directory: " & $objItem.Directory & @CRLF
      $Output = $Output & "Volume: " & $objItem.Volume & @CRLF
      if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
      $Output=""
   Next
Else
   Msgbox(0,"WMI 输出","No WMI Objects Found for class: " & "Win32_MountPoint" )
Endif


[/au3]
不知道是不是你想要的。

评分

参与人数 1金钱 +2 收起 理由
ceoguang + 2 谢谢帮忙

查看全部评分

 楼主| 发表于 2008-7-13 21:20:40 | 显示全部楼层
谢谢,正是我要的.
发表于 2008-10-31 09:03:34 | 显示全部楼层

因为代码有点看不懂

怎么都没见有反映的  运行了没见有反映的
 楼主| 发表于 2008-10-31 10:46:39 | 显示全部楼层
检查下WMI服务是否启动
发表于 2012-2-26 14:55:18 | 显示全部楼层
进来学习了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-30 21:35 , Processed in 0.074720 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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