<%@ Language=VBScript %>
<%
Option Explicit
Response.Expires = 0
On Error Resume Next
'Kein Resultat
'*****************************************************************
'Lokale Prozeduren und Funktionen
Sub procshowdrivelist()
Dim objcolldrives
Dim objdrive
Dim objfs
Dim strdrivetype
Set objfs = CreateObject("Scripting.FileSystemObject")
Set objcolldrives = objfs.Drives
Response.Write("<table border=""1"">" & vbCrLf)
'Tabellenbeschriftung
Response.Write(" <tr>" & vbCrLf)
Response.Write(" <td>" & vbCrLf)
Response.Write(" <b>Laufwerk</b>" & vbCrLf)
Response.Write(" </td>" & vbCrLf)
Response.Write(" <td>" & vbCrLf)
Response.Write(" <b>Typ</b>" & vbCrLf)
Response.Write(" </td>" & vbCrLf)
Response.Write(" <td>" & vbCrLf)
Response.Write(" <b>Name</b>" & vbCrLf)
Response.Write(" </td>" & vbCrLf)
Response.Write(" <td>" & vbCrLf)
Response.Write(" <b>Dateisystem</b>" & vbCrLf)
Response.Write(" </td>" & vbCrLf)
Response.Write(" <td align=""right"">" & vbCrLf)
Response.Write(" <b>Gesamtgrösse</b>" & vbCrLf)
Response.Write(" </td>" & vbCrLf)
Response.Write(" <td align=""right"">" & vbCrLf)
Response.Write(" <b>Verfügbarer Platz</b>" & vbCrLf)
Response.Write(" </td>" & vbCrLf)
Response.Write(" <td align=""right"">" & vbCrLf)
Response.Write(" <b>Freier Platz</b>" & vbCrLf)
Response.Write(" </td>" & vbCrLf)
Response.Write(" <td>" & vbCrLf)
Response.Write(" <b>Seriennummer</b>" & vbCrLf)
Response.Write(" </td>" & vbCrLf)
Response.Write(" </tr>" & vbCrLf)
For Each objdrive in objcolldrives
Response.Write(" <tr>" & vbCrLf)
'Drive Letter
Response.Write(" <td>" & vbCrLf)
Response.Write(" " & objdrive.DriveLetter & ":" & vbCrLf)
Response.Write(" </td>" & vbCrLf)
'Drive Type
Select Case objdrive.DriveType
Case 0: strdrivetype = "Unknown"
Case 1: strdrivetype = "Removable"
Case 2: strdrivetype = "Fixed"
Case 3: strdrivetype = "Network"
Case 4: strdrivetype = "CD-ROM"
Case 5: strdrivetype = "RAM Disk"
End Select
Response.Write(" <td>" & vbCrLf)
Response.Write(" " & strdrivetype & vbCrLf)
Response.Write(" </td>" & vbCrLf)
'Drive name
Response.Write(" <td>" & vbCrLf)
If objdrive.DriveType = 3 Then
Response.Write(" " & objdrive.ShareName & vbCrLf)
ElseIf objdrive.IsReady Then
Response.Write(" " & objdrive.VolumeName & vbCrLf)
Else
Response.Write("<font color=""red"">nicht verfügbar</font>" & vbCrLf)
End If
Response.Write(" </td>" & vbCrLf)
'Dateisystem
Response.Write(" <td>" & vbCrLf)
If objdrive.IsReady Then
Response.Write(" " & objdrive.FileSystem & vbCrLf)
Else
Response.Write(" " & vbCrLf)
End If
Response.Write(" </td>" & vbCrLf)
'Total Size
Response.Write(" <td align=""right"">" & vbCrLf)
If objdrive.IsReady Then
Response.Write(" " & formatnumber((objdrive.TotalSize/1024^2),1) & " MB" & vbCrLf)
Else
Response.Write(" " & vbCrLf)
End If
Response.Write(" </td>" & vbCrLf)
'Available Space
Response.Write(" <td align=""right"">" & vbCrLf)
If objdrive.IsReady Then
Response.Write(" " & formatnumber((objdrive.AvailableSpace/1024^2),1) & " MB" & vbCrLf)
Else
Response.Write(" " & vbCrLf)
End If
Response.Write(" </td>" & vbCrLf)
'Free Space
Response.Write(" <td align=""right"">" & vbCrLf)
If objdrive.IsReady Then
Response.Write(" " & formatnumber((objdrive.FreeSpace/1024^2),1) & " MB" & vbCrLf)
Else
Response.Write(" " & vbCrLf)
End If
Response.Write(" </td>" & vbCrLf)
'Seriennummer
Response.Write(" <td>" & vbCrLf)
If objdrive.IsReady Then
Response.Write(" " & objdrive.SerialNumber & vbCrLf)
Else
Response.Write(" " & vbCrLf)
End If
Response.Write(" </td>" & vbCrLf)
Response.Write(" </tr>" & vbCrLf)
Next
Response.Write("</table>" & vbCrLf)
End Sub
'*****************************************************************
'Anfang Code
'*****************************************************************
'Anfang <html>
%>
<!--#include virtual="asppages/silvi/_include/preheader.inc" -->
<html>
<head>
<title>ASP Weitere Objekte: Laufwerke und ihre Eigenschaften auflisten
</title>
<meta name="description" content="" />
<meta name="keywords" content="ASP, Laufwerk, Drive" />
<!--#include virtual="asppages/silvi/_include/header.inc" -->
</head>
<body>
<%
'*****************************************************************
'Code innerhalb der HTML-Seite
call procshowdrivelist()
%>
<p>Freier und verfügbarer Platz unterscheiden sich nur auf Computersystemen mit Quoten.
</p>
<!--#include virtual="asppages/silvi/_include/inchtmlnachspann.asp" -->
</body>
</html>
Letzter Update:
26.12.2021 16:48
Zurück zur
Liste mit ASP-Beispielen auf
www.ecotronics.ch