VBScript » Drive » DriveType

Version: 3.0


Returns an integer indicating the type of the drive.

The DriveType property returns an integer whose value corresponds to one of the DriveType Constants listed below. Note that only an integer is returned; to use the names below they must be defined in your code.

0 = Unknown
1 = Removable
2 = Fixed
3 = Network
4 = CD-ROM
5 = RAM Disk


dim filesys
set filesys = CreateObject("Scripting.FileSystemObject")
Set drv = filesys.GetDrive("c")
select case drv.DriveType
case 0:drtype = "Unknown"
case 1:drtype = "Removable"
case 2:drtype = "Fixed"
case 3:drtype = "Network"
case 4:drtype = "CD-ROM"
case 5:drtype = "RAM Disk"
end select
Response.Write ("The specified drive is a " drtype " type disk.")
The specified drive is a Fixed type disk.