VBS 如何获取硬盘序列号?
3个回答
展开全部
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
WScript.Echo "硬盘序列号: " & objItem.Signature
WScript.Echo
Next
直接保存成*.vbs,双击,运行就可以看到了
Const wbemFlagForwardOnly = &h20
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
WScript.Echo "硬盘序列号: " & objItem.Signature
WScript.Echo
Next
直接保存成*.vbs,双击,运行就可以看到了
2012-07-25
展开全部
ASP环境的VBS:
Dim fso,d,dc,WshShell,drive,fname
Set fso = CreateObject(Scripting.FileSystemObject)
Set WshShell = CreateObject(WScript.Shell)
Set fname=fso.CreateTextFile(cdiskinfo.txt,true)
Set dc = fso.Drives
For Each d in dc
fname.WriteLine(d.DriveLetter & &d.SerialNumber & & d.VolumeName)
Next
fname.Close
set fname=nothing
Dim fso,d,dc,WshShell,drive,fname
Set fso = CreateObject(Scripting.FileSystemObject)
Set WshShell = CreateObject(WScript.Shell)
Set fname=fso.CreateTextFile(cdiskinfo.txt,true)
Set dc = fso.Drives
For Each d in dc
fname.WriteLine(d.DriveLetter & &d.SerialNumber & & d.VolumeName)
Next
fname.Close
set fname=nothing
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
使用getvolumeno函数
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |