ASP DriveType Property
Last Updated :
22 Mar, 2021
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:
- 0: This is used for unknown drives.
- 1: This is used for removable drives.
- 2: This is used for fixed drives.
- 3: This is used for network drives.
- 4: This is used for CD-ROMs.
- 5: This is used for RAM disks.
Syntax:
DriveObject.DriveType
The below examples illustrate the ASP Drive.DriveType Property.
Example 1: Using a hard drive.
ASP
<%
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.
ASP
<%
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
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...