Open In App

ASP DriveType Property

The ASP DriveType Property is used to get the type of the given drive. It returns a numeric value between 0 and 5 that specifies the type of drive as given below:

Syntax:



DriveObject.DriveType

 The below examples illustrate the ASP Drive.DriveType Property.

Example 1: Using a hard drive.






<%
dim fs,dr
set fs=Server.CreateObject("Scripting.FileSystemObject")
  
'Getting the drive
set dr=fs.GetDrive("d:")
  
'Getting the type of the drive
Response.Write("The type of the drive is: " & dr.DriveType)
  
set dr=nothing
set fs=nothing
%>

Output:

The type of the drive is: 2

Example 2: Using a floppy disk drive.




<%
dim fs,dr
set fs=Server.CreateObject("Scripting.FileSystemObject")
  
'Getting the drive
set dr=fs.GetDrive("a:")
  
'Getting the type of the drive
Response.Write("The type of the drive is: " & dr.DriveType)
  
set dr=nothing
set fs=nothing
%>

Output:

The type of the drive is: 1
Article Tags :