Set fso=Server.CreateObject("Scripting.FileSystemObject") |
<%Set fso=Server.CreateObject("Scripting.FileSystemObject")%> <%=fso.GetDriveName("d:")%><br> <%=fso.GetDrive("d:")%> |
<% Set fso=Server.CreateObject("Scripting.FileSystemObject") Set drv=fso.GetDrive(fso.GetDriveName("d:")) %> 该盘的空间大小:<%=drv.TotalSize%><br> 该盘的剩余空间大小:<%=drv.FreeSpace%> |
<% Function ShowDriveInfo(drvPath) Dim fso, drv, s Set fso = CreateObject("Scripting.FileSystemObject") Set drv = fso.GetDrive(fso.GetDriveName(drvPath)) s = "驱动盘" & drv & "的卷标是:" s = s & drv.VolumeName & "<br>" s = s & "总计空间:" & drv.TotalSize & "<br>" s = s & "剩余空间:" & drv.FreeSpace & "<br>" s = s & "文件类型:" & drv.DriveType & "<br>" s = s & "文件系统:" & drv.FileSystem Response.Write s End Function %> <% on error resume next whatpath=request.form("path") if whatpath<>"" then ShowDriveInfo(whatpath) end if%> <form action="drvinfo.asp" method="post"> <input name="path"> <input type="submit"> </form> |
<% Function tran(Driver) Select Case Driver Case 0: tran="设备无法识别" Case 1: tran="软盘驱动器" Case 2: tran="硬盘驱动器" Case 3: tran="网络硬盘驱动器" Case 4: tran="光盘驱动器" Case 5: tran="RAM虚拟磁盘" End Select End Function set fso=Server.CreateObject("Scripting.FileSystemObject") %> <table border=1 width="100%"> <tr> <td>盘符</td> <td>类型</td> <td>卷标</td> <td>总计大小</td> <td>可用空间</td> <td>文件系统</td> <td>序列号</td> <td>是否可用</td> <td>路径</td> </tr> <% on error resume next For each drv in fso.Drives Response.Write "<tr>" Response.Write "<td>" & drv.DriveLetter & "</td>" Response.write "<td>" & tran(drv.DriveType) & "</td>" Response.write "<td>" & drv.VolumeName & "</td>" Response.write "<td>" & FormatNumber(drv.TotalSize / 1024, 0)& "</td>" Response.write "<td>" & FormatNumber(drv.Availablespace / 1024, 0) & "</td>" Response.write "<td>" & drv.FileSystem & "</td>" Response.write "<td>" & drv.SerialNumber & "</td>" Response.write "<td>" & drv.IsReady & "</td>" Response.write "<td>" & drv.Path & "</td>" Response.Write "</tr>" Next set fs=nothing %> </table> |
……