可以利用DriveGetDrive 自动识别
--------------------------------------------------------------------------------
DriveGetDrive ( "类型" )
返回一个含有指定驱动器盘符的数组
要获得的驱动器类型:
"ALL(全部)", "CDROM(光驱)", "REMOVABLE(可移动驱动器)", "FIXED(固定驱动器)", "NETWORK(网络驱动器)", "RAMDISK(内存盘)", or "UNKNOWN(未知类型)"$var = DriveGetDrive( "CDROM" )
If NOT @error Then
MsgBox(4096,"", "找到 " & $var[0] & " 个CDROM")
For $i = 1 to $var[0]
MsgBox(4096,"" ,$i&':CDROM盘符:'& $var[$i])
CDTray($var[$i], "open")
Sleep(2000)
CDTray($var[$i], "closed")
Next
EndIf
|