关于ASP读取硬盘序列号的问题
下面两个代码都是网上找的,怎么读出来的号不一样呢?硬盘序列号是唯一的吗?到低哪个是正确的,我下了两款软件读出来的序列号都不一样。
<%@ LANGUAGE=VBScript%>
<%
Response.Buffer = True
Response.Expires = 0
Response.CacheControl = "Private"
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set drv = fs.GetDrive(Left(Server.MapPath("."), 2))
Response.Write "SerialNumber is " & drv.SerialNumber & "<br>"
Response.Write "TotalSize is " & drv.TotalSize & "<br>"
Set drv = Nothing
Set fs = Nothing
%>
<%
Sub ShowDriveInfo(drvpath)
Dim fs, d, s, t
Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetDrive(fs.GetDriveName(fs.GetAbsolutePathName(drvpath)))
Select Case d.DriveType
Case 0: t = "未知"
Case 1: t = "可移动"
Case 2: t = "固定"
Case 3: t = "网络"
Case 4: t = "CD-ROM"
Case 5: t = "RAM 磁盘"
End Select
s = "驱动器 " & d.DriveLetter & ": - " & t
s = s & vbCrLf & "序列号: " & d.SerialNumber
response.Write(s)
End Sub
call ShowDriveInfo("c:\")
%>
------解决方案--------------------
觉得这个读出来的是某个盘的序列号,比如D盘E盘的,而不是整个硬盘