如果指定驅(qū)動器已就緒則返回 True ;否則 False。
object.IsReady
object 應(yīng)為 Drive 對象。
對于可移動媒體的驅(qū)動器和 CD-ROM 驅(qū)動器來說,IsReady 只有在插入了適當(dāng)?shù)拿襟w并已準(zhǔn)備好訪問時才返回 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 屬性
應(yīng)用于:Drive 對象