;;;;; 纯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)
|