DriveGetDrive

首页  后退  前进

DriveGetDrive
down2

DriveGetDrive

返回枚举驱动器的数组.

 

DriveGetDrive ( "type" )

参数

type

驱动器类型:

   $DT_ALL ("ALL") - 全部

   $DT_CDROM ("CDROM") - 光驱

   $DT_REMOVABLE ("REMOVABLE") - 可移动

   $DT_FIXED ("FIXED") - 固定

   $DT_NETWORK ("NETWORK") - 网络

   $DT_RAMDISK ("RAMDISK") - 内存盘

   $DT_UNKNOWN ("UNKNOWN") - 未知

 

常量定义在 AutoItConstants.au3

返回值

成功:

返回字符串数组(驱动器盘符后接一个冒号). 数组元素 [0] 包含驱动器的数量.

失败:

设置 @error 为 1.

相关

DriveGetFileSystem, DriveGetLabel, DriveGetSerial, DriveGetType, DriveSetLabel, DriveSpaceFree, DriveSpaceTotal, DriveStatus

函数示例

#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
Local $aArray = DriveGetDrive($DT_ALL)
If @error Then
    ; An error occurred when retrieving the drives.
    MsgBox($MB_SYSTEMMODAL, "", "It appears an error occurred.")
Else
    For $i = 1 To $aArray[0]
        ; Show all the drives found and convert the drive letter to uppercase.
        MsgBox($MB_SYSTEMMODAL, "", "Drive " & $i & "/" & $aArray[0] & ":" & @CRLF & StringUpper($aArray[$i]))
    Next
EndIf

----------------------------------------

 

该函数可以通过命令 exect 调用

例子
copy

exect=$var_aa=DriveGetDrive('ALL') GLOBALEXECT<$var_aa> ;; 数组,包含设备列表

 


tcimage © Аверин Андрей для Total Commander Image Averin-And@yandex.ru