脚本运行时库  

DriveType 属性

返回一个值,表示所指定驱动器的类型。

object.DriveType 

其中 object 总是一个 Drive 对象。

说明

下面这段代码说明了 DriveType 属性的用法:

[JScript]
function ShowDriveType(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;
   return(s);
}
[VBScript]
Function ShowDriveType(drvpath)
   Dim fso, d, 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
   ShowDriveType = "Drive " & d.DriveLetter & ":- " & t
End Function

请参阅

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

应用于:Drive 对象