DriveGetDrive怎样返回一组没有移动硬盘盘符的数组
当使用DriveGetDrive ( "FIXED" )时只能返回一组所有硬盘的盘符数组(包括移动硬盘)不知有没有只返回本地硬盘盘符数组的的这样的自定义参数
希望像DriveGetDrive一样能返回一组FIXED(也就返回本地硬盘盘符数组)和返回一组REMOVABLE_DISK(也就返回移动硬盘盘符数组)
如果要调用pusofalse 版主的 _CM_Get_Drive_Type($sDrive) 很明显会出现AUTOIT.EXE错误和过慢,希望能像DriveGetDrive一样快速地返回
谢谢 看看winapiex里的吧,有个函数直接出来 WinAPI Extended UDF#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $Bus, $Text, $Drive = DriveGetDrive('FIXED')
For $i = 1 To $Drive
$Bus = _WinAPI_GetDriveBusType($Drive[$i])
Switch $Bus
Case $DRIVE_BUS_TYPE_UNKNOWN
$Text = 'UNKNOWN'
Case $DRIVE_BUS_TYPE_SCSI
$Text = 'SCSI'
Case $DRIVE_BUS_TYPE_ATAPI
$Text = 'ATAPI'
Case $DRIVE_BUS_TYPE_ATA
$Text = 'ATA'
Case $DRIVE_BUS_TYPE_1394
$Text = '1394'
Case $DRIVE_BUS_TYPE_SSA
$Text = 'SSA'
Case $DRIVE_BUS_TYPE_FIBRE
$Text = 'FIBRE'
Case $DRIVE_BUS_TYPE_USB
$Text = 'USB'
Case $DRIVE_BUS_TYPE_RAID
$Text = 'RAID'
Case $DRIVE_BUS_TYPE_ISCSI
$Text = 'ISCSI'
Case $DRIVE_BUS_TYPE_SAS
$Text = 'SAS'
Case $DRIVE_BUS_TYPE_SATA
$Text = 'SATA'
Case $DRIVE_BUS_TYPE_SD
$Text = 'SD'
Case $DRIVE_BUS_TYPE_MMC
$Text = 'MMC'
EndSwitch
ConsoleWrite(StringUpper($Drive[$i]) & ' => ' & $Text & @CR)
Next借用DriveGetDrive('FIXED')返回以下文件,但怎样才可以自定义一个函数返回这些数组呢?
比如自定义一个函数 “_DriveGetDrive(' ')” 当使用 _DriveGetDrive('FIXED') 时返回一组数组分别为:C:~F: ,
_DriveGetDrive('REMOVABLE_DISK') 返回一组数组分别为:H: 呢?
谢谢!
C: => ATA
D: => ATA
E: => ATA
F: => ATA
H: => USB 本帖最后由 netegg 于 2009-11-23 00:27 编辑
#include<array.au3>
global $aDisk
_arraydisplay(_DriveGetDrive('ata'), '')
func _DriveGetDrive($type)
For $i = 1 To $Drive
$Bus = _WinAPI_GetDriveBusType($Drive[$i])
Switch $Bus
Case $DRIVE_BUS_TYPE_UNKNOWN
$Text = 'UNKNOWN'
Case $DRIVE_BUS_TYPE_SCSI
$Text = 'SCSI'
Case $DRIVE_BUS_TYPE_ATAPI
$Text = 'ATAPI'
Case $DRIVE_BUS_TYPE_ATA
$Text = 'ATA'
Case $DRIVE_BUS_TYPE_1394
$Text = '1394'
Case $DRIVE_BUS_TYPE_SSA
$Text = 'SSA'
Case $DRIVE_BUS_TYPE_FIBRE
$Text = 'FIBRE'
Case $DRIVE_BUS_TYPE_USB
$Text = 'USB'
Case $DRIVE_BUS_TYPE_RAID
$Text = 'RAID'
Case $DRIVE_BUS_TYPE_ISCSI
$Text = 'ISCSI'
Case $DRIVE_BUS_TYPE_SAS
$Text = 'SAS'
Case $DRIVE_BUS_TYPE_SATA
$Text = 'SATA'
Case $DRIVE_BUS_TYPE_SD
$Text = 'SD'
Case $DRIVE_BUS_TYPE_MMC
$Text = 'MMC'
EndSwitch
switch $text
case $type
_arrayadd($aDisk, StringUpper($Drive[$i]) )
endswitch
Next
return $aDisk
endfunc
页:
[1]