programming-examples/asp/More_Code_Snippets/Display all available drives on your system and displays.asp

25 lines
777 B
Plaintext
Raw Permalink Normal View History

2019-11-18 14:25:58 +01:00
<%
'declare our variables
Dim objFSO , objDrive , drive
'create an instance of FileSystemObject
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objDrive = objFSO.Drives
'loop through every drive that is present
For Each drive in objDrive
'if the drive is ready then execute the following
If drive.IsReady Then
Response.Write drive.DriveLetter & "<br>"
Response.Write drive.Path & "<br>"
Response.Write drive.FileSystem & "<br>"
Response.Write drive.TotalSize & "<br>"
Response.Write drive.FreeSpace & "<br>"
'if the drive is not ready execute the following
Else
Response.Write drive.DriveLetter & "<br>"
Response.Write "is unavailable"
End If
Next
destroy objects
Set objDrive = Nothing
Set objFSO = Nothing
%>