找回密码
 加入
搜索
查看: 2300|回复: 8

[系统综合] 已解决 如何获取磁盘分区的挂载点?

  [复制链接]
发表于 2012-5-3 17:30:08 | 显示全部楼层 |阅读模式
本帖最后由 Qokelate 于 2012-5-3 19:53 编辑

通过命令MountVol可以列出当前所有盘的挂载点,纯Au3实现(不调用第三方程序)的话怎样实现?




4楼见真相

本帖子中包含更多资源

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

×
发表于 2012-5-3 18:43:31 | 显示全部楼层
挂载点?linux?
我可以将挂载点理解为分区么。
DriveGetDrive( "all" )
 楼主| 发表于 2012-5-3 19:00:07 | 显示全部楼层
回复 2# haijie1223


    。。。   打错了   应该是装入点,就是图里那个  \\?\*************\
发表于 2012-5-3 19:00:12 | 显示全部楼层
#Include <WinAPIEx.au3>
_WinAPI_GetVolumeNameForVolumeMountPoint
发表于 2012-5-3 19:30:42 | 显示全部楼层
这里面所有的 HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices  

并且 DriveGetDrive( "all" ) 也有的 取出来 , DriveGetDrive( "all" ) 没有的滤掉
发表于 2012-5-3 19:58:48 | 显示全部楼层

;;;;;   纯au3实现
#include <array.au3>
Local $drive_array = DriveGetDrive("ALL")
;_ArrayDisplay($drive_array)

Local $read_reg_array[21][2]
$read_reg_array[0][0] = 20

Local $item
Local $value
Local $i
Local $loopend

For $i = 1 to 20
        $item = RegEnumVal("HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices", $i)
        if @error <> 0 Then ExitLoop
        $value = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices", $item)
        $read_reg_array[$i][0] = $item
        $read_reg_array[$i][1] = $value
next
$loopend = $i - 1
;_ArrayDisplay($read_reg_array)

Local $array[21][2]
$array[0][0] = 20
Local $j
Local $k = 1
For $i = 1 To $loopend-1
        For $j = $i+1 To $loopend
                If Not StringCompare($read_reg_array[$i][1], $read_reg_array[$j][1]) Then 
                        $array[$k][0] = $read_reg_array[$i][0]
                        $array[$k][1] = $read_reg_array[$j][0]
                        $k += 1
                        ExitLoop
                EndIf
        Next
Next
;_ArrayDisplay($array)
For $i = $k - 1 To 1 Step -1
        For $j = 1 To $drive_array[0]
                If StringInStr($array[$i][0], $drive_array[$j]) Or StringInStr($array[$i][1], $drive_array[$j]) Then 
                        ExitLoop
                EndIf
        Next
        If $j>$drive_array[0] Then
                _ArrayDelete($array, $i)
        EndIf
Next
_ArrayDisplay($array)
发表于 2012-5-3 20:08:19 | 显示全部楼层
用 API 就 简单了

#include <WinAPIEx.au3>
Local $drive_array = DriveGetDrive("ALL")
Local $msgboxtext = ""
Local $i
For $i = 1 To $drive_array[0]
        $msgboxtext &= $drive_array[$i] & " ---> " & _WinAPI_GetVolumeNameForVolumeMountPoint($drive_array[$i] & "\") & @CRLF
Next
MsgBox(0, "", $msgboxtext)
发表于 2012-5-3 21:25:05 | 显示全部楼层
7楼 简化了 不错
发表于 2012-5-3 22:11:50 | 显示全部楼层
获取了这个有什么作用?
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-30 13:16 , Processed in 0.106920 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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