<% Set fso=Server.CreateObject("Scripting.FileSystemObject") Set drv=fso.GetDrive(fso.GetDriveName("d:")) %> 该盘的空间大小:<%=drv.TotalSize%><br> 该盘的剩余空间大小:<%=drv.FreeSpace%>
以上只是提取的D盘驱动器的信息,来个通用的函数,继续分别测试自己的驱动吧。
3,drvinfo.asp
<% 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") %>