下面就用一个程序遍历显示自己机器上所有驱动器的信息。
4,showall.ASP
<%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 Functionset
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>"Nextset fs=nothing%>
</table>
演示
恩,是不是很神气?那你可以对自己的机器调试,然后上传到自己的空间去调试,你会发现服务商会你进行了些设置:)
当然更神的还在后面面,比如对文件夹,对文件的操作(包括添加、修改和删除)。
ps:你对驱动器是不能轻易添加删除的:)