脚本运行时库  

IsReady 属性

如果指定驱动器已就绪则返回 True ;否则 False

object.IsReady 

object 应为 Drive 对象。

说明

对于可移动媒体的驱动器和 CD-ROM 驱动器来说,IsReady 只有在插入了适当的媒体并已准备好访问时才返回 True

下面的代码说明了 IsReady 属性的用法:

[JScript]
function ShowDriveInfo(drvpath)
{
   var fso, d, s, t;
   fso = new ActiveXObject("Scripting.FileSystemObject")
   d = fso.GetDrive(drvpath)
   switch (d.DriveType)
   {
      case 0:t = "Unknown"; break;
      case 1:t = "Removable"; break;
      case 2:t = "Fixed"; break;
      case 3:t = "Network"; break;
      case 4:t = "CD-ROM"; break;
      case 5:t = "RAM Disk"; break;
   }
   s = "Drive " + d.DriveLetter + ":- " + t;
   if (d.IsReady)
      s += "<br>" + "Drive is Ready.";
   else
      s += "<br>" + "Drive is not Ready.";
   return(s);
}
[VBScript]
Function ShowDriveInfo(drvpath)
   Dim fso, d, s, t
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set d = fso.GetDrive(drvpath)
   Select Case d.DriveType
      Case 0:t = "Unknown"
      Case 1:t = "Removable"
      Case 2:t = "Fixed"
      Case 3:t = "Network"
      Case 4:t = "CD-ROM"
      Case 5:t = "RAM Disk"
   End Select
   s = "Drive " & d.DriveLetter & ":- " & t
   If d.IsReady Then 
      s = s & "<BR>" & "Drive is Ready."
   Else
      s = s & "<BR>" & "Drive is not Ready."
   End If
   ShowDriveInfo = s
End Function

请参阅

AvailableSpace 属性 | DriveLetter 属性 | DriveType 属性 | FileSystem 属性 | FreeSpace 属性 | Path 属性 | RootFolder 属性 | SerialNumber 属性 | ShareName 属性 | TotalSize 属性 | VolumeName 属性

应用于:Drive 对象