神剑山庄资源网 Design By www.hcban.com

WinXP,Win7,Win8
复制代码 代码如下:
'原创内容转载、引用代码核心部分请注明出处
硬盘读写统计.vbs
If (Lcase(Right(Wscript.FullName,11)) = "wscript.exe") Then
   CreateObject("WScript.Shell").Run("%Comspec% /C " &Chr(34)&"mode con cols=52 lines=22" &"&Title  硬盘读写统计.vbs  By: FastSLZ  PCEVA Or BatHome   &&Cscript.exe //NoLogo  "&Chr(34)& Wscript.ScriptFullName &Chr(34)&Chr(34)),3:Set WMI = Nothing:Wscript.Quit
End If
Dim WMI,vName,IDE,cPPP,sNow
Input = 1:InputS = Input*980
On Error Resume Next
Set WMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set IDE = WMI.ExecQuery("Select * from Win32_DiskDrive WHERE InterfaceType='IDE'")
Set cPPP = WMI.ExecQuery("SELECT * FROM Win32_PerfRawData_PerfDisk_PhysicalDisk WHERE Name <> '_Total'")
For Each oIDE In IDE
    For i = 0 To IDE.Count  
        Select Case oIDE.Index
            Case i
               For Each oPPP In cPPP
                   If InStr(oPPP.Name, i) Then vName = oPPP.Name
               Next
               Select Case i
                   Case 0 Disk0=oIDE.Caption&" "&oIDE.FirmwareRevision:Size0=oIDE.Size:DskP0=vName
                   Case 1 Disk1=oIDE.Caption&" "&oIDE.FirmwareRevision:Size1=oIDE.Size:DskP1=vName
                   Case 2 Disk2=oIDE.Caption&" "&oIDE.FirmwareRevision:Size2=oIDE.Size:DskP2=vName
                   Case 3 Disk3=oIDE.Caption&" "&oIDE.FirmwareRevision:Size3=oIDE.Size:DskP3=vName
                   Case 4 Disk4=oIDE.Caption&" "&oIDE.FirmwareRevision:Size4=oIDE.Size:DskP4=vName
                   Case 5 Disk5=oIDE.Caption&" "&oIDE.FirmwareRevision:Size5=oIDE.Size:DskP5=vName
               End Select

        End Select
    Next
Next
Set cPPP = Nothing:Set IDE= Nothing
If Disk0 <> "" Then WScript.Echo Left(DskP0,1)&":"&vbTab& Disk0 &vbTab _
                  &vbCrLf&vbTab&"厂商容量:"&Round(Size0/1000000000) &"GB" _
                  &vbCrLf&vbTab&"实际容量:"&Round(Size0/1073741824,2) &"GB" _
                  &vbCrLf&vbTab&"分区状态:"&Right(DskP0,Len(DskP0)-2)
If Disk1 <> "" Then WScript.Echo Left(DskP1,1)&":"&vbTab& Disk1 &vbTab _
                  &vbCrLf&vbTab&"厂商容量:"&Round(Size1/1000000000) &"GB" _
                  &vbCrLf&vbTab&"实际容量:"&Round(Size1/1073741824,2) &"GB" _
                  &vbCrLf&vbTab&"分区状态:"&Right(DskP1,Len(DskP1)-2)
If Disk2 <> "" Then WScript.Echo Left(DskP2,1)&":"&vbTab& Disk2 &vbTab _
                  &vbCrLf&vbTab&"厂商容量:"&Round(Size2/1000000000) &"GB" _
                  &vbCrLf&vbTab&"实际容量:"&Round(Size2/1073741824,2) &"GB" _
                  &vbCrLf&vbTab&"分区状态:"&Right(DskP2,Len(DskP2)-2)
If Disk3 <> "" Then WScript.Echo Left(DskP3,1)&":"&vbTab& Disk3 &vbTab _
                  &vbCrLf&vbTab&"厂商容量:"&Round(Size3/1000000000) &"GB" _
                  &vbCrLf&vbTab&"实际容量:"&Round(Size3/1073741824,2) &"GB" _
                  &vbCrLf&vbTab&"分区状态:"&Right(DskP3,Len(DskP3)-2)
If Disk4 <> "" Then WScript.Echo Left(DskP4,1)&":"&vbTab& Disk4 &vbTab _
                  &vbCrLf&vbTab&"厂商容量:"&Round(Size4/1000000000) &"GB" _
                  &vbCrLf&vbTab&"实际容量:"&Round(Size4/1073741824,2) &"GB" _
                  &vbCrLf&vbTab&"分区状态:"&Right(DskP4,Len(DskP4)-2)
If Disk5 <> "" Then WScript.Echo Left(DskP5,1)&":"&vbTab& Disk5 &vbTab _
                  &vbCrLf&vbTab&"厂商容量:"&Round(Size5/1000000000) &"GB" _
                  &vbCrLf&vbTab&"实际容量:"&Round(Size5/1073741824,2) &"GB" _
                  &vbCrLf&vbTab&"分区状态:"&Right(DskP5,Len(DskP5)-2)
WScript.Echo "↑请输入要监控的硬盘编号,并按回车键"
stdInput = WScript.StdIn.Readline
stdInput=Left(UCase(stdInput),1)
If stdInput > "5" Or stdInput < "0" Then MsgBox "输入错误" :WScript.Quit
If InStr(DskP0, stdInput) Then Call Network(Disk0,Size0,DskP0)
If InStr(DskP1, stdInput) Then Call Network(Disk1,Size1,DskP1)
If InStr(DskP2, stdInput) Then Call Network(Disk2,Size2,DskP2)
If InStr(DskP3, stdInput) Then Call Network(Disk3,Size3,DskP3)
If InStr(DskP4, stdInput) Then Call Network(Disk4,Size4,DskP4)
If InStr(DskP5, stdInput) Then Call Network(Disk5,Size5,DskP5)

Sub Network(Disks,Sizes,DskPs)
sNow=Now
Do
Dim A
'WScript.Echo "已运行"&Ts\3600&"小时"&(Ts mod 3600)\60&"分钟"&(Ts mod 3600) mod 60&"秒"
Set A = WMI.ExecQuery("Select * from Win32_PerfRawData_PerfDisk_PhysicalDisk Where Name='"&DskPs&"'")
For Each B In A
    R1 = B.DiskReadBytesPersec
    W1 = B.DiskWriteBytesPersec
    If RA0 = "" Then RA0 = B.DiskReadBytesPersec Else RA1 = R1 End If
    If WA0 = "" Then WA0 = B.DiskWriteBytesPersec Else WA1 = W1 End If
Next
Set A = Nothing
WScript.Sleep(InputS)
Set A = WMI.ExecQuery("Select * from Win32_PerfRawData_PerfDisk_PhysicalDisk Where Name='"&DskPs&"'")
For Each B In A
    R2 = B.DiskReadBytesPersec
    W2 = B.DiskWriteBytesPersec
Next
Set A = Nothing
WScript.Echo Disks &" " &Round(Sizes/1073741824) &"GB" &vbCrLf _
      &"实时读取:" & CheckSize((R2-R1)/Input) &"/s" &vbCrLf _
      &"实时写人:" & CheckSize((W2-W1)/Input) &"/s"&vbCrLf _
      &"脚本累计读取:" & CheckSize(RA1-RA0) &vbCrLf _
      &"脚本累计写入:" & CheckSize(WA1-WA0) &vbCrLf _
      &"开机累计读取:" & CheckSize(R1) &vbCrLf _
      &"开机累计写入:" & CheckSize(W1) &vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf _
      &"已运行"&Ts\3600&"小时"&(Ts mod 3600)\60&"分钟"&(Ts mod 3600) mod 60&"秒"
Ts=DateDiff("s", sNow, Now)'Ts=TS+1
Loop
End Sub

Function CheckSize(SZ)
On Error Resume Next
If SZ => 1073741824 Then
   SZ = FormatNumber(Round(SZ/1073741824,2))&" GB"
   ElseIf SZ => 1048576 Then
   SZ = FormatNumber(Round(SZ/1048576,2))&" MB"
   ElseIf SZ => 1024 Then
   SZ = FormatNumber(Round(SZ/1024,2))&" KB"
Else
   SZ = "0"&FormatNumber(Round(SZ/1024,2)) & " KB"
End If
CheckSize=Right("      " & SZ,10)
End Function

分区读写统计.vbs
复制代码 代码如下:
'原创内容转载、引用代码核心部分请注明出处
If (Lcase(Right(Wscript.FullName,11)) = "wscript.exe") Then
   CreateObject("WScript.Shell").Run("%Comspec% /C " &Chr(34)&"mode con cols=52 lines=22" &"&Title  分区读写统计.vbs  By: FastSLZ  PCEVA Or BatHome   &&Cscript.exe //NoLogo  "&Chr(34)& Wscript.ScriptFullName &Chr(34)&Chr(34)),3:Set WMI = Nothing:Wscript.Quit
End If
Input = 1:InputS = Input*1000
Dim WMI,vName,IDE,cPPP,sNow
On Error Resume Next
Set WMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

Set IDE = WMI.ExecQuery("Select * from Win32_DiskDrive WHERE InterfaceType='IDE'")
Set cPPP = WMI.ExecQuery("SELECT * FROM Win32_PerfRawData_PerfDisk_PhysicalDisk WHERE Name<>'_Total'")
For Each oIDE In IDE
    For i = 0 To IDE.Count  
        Select Case oIDE.Index
            Case i
               For Each oPPP In cPPP
                   If InStr(oPPP.Name, i) Then vName = oPPP.Name
               Next
               Select Case i
                   Case 0 Disk0=oIDE.Caption&" "&oIDE.FirmwareRevision:Size0=oIDE.Size:DskP0=vName
                   Case 1 Disk1=oIDE.Caption&" "&oIDE.FirmwareRevision:Size1=oIDE.Size:DskP1=vName
                   Case 2 Disk2=oIDE.Caption&" "&oIDE.FirmwareRevision:Size2=oIDE.Size:DskP2=vName
                   Case 3 Disk3=oIDE.Caption&" "&oIDE.FirmwareRevision:Size3=oIDE.Size:DskP3=vName
                   Case 4 Disk4=oIDE.Caption&" "&oIDE.FirmwareRevision:Size4=oIDE.Size:DskP4=vName
                   Case 5 Disk5=oIDE.Caption&" "&oIDE.FirmwareRevision:Size5=oIDE.Size:DskP5=vName
               End Select

        End Select
    Next
Next
Set cPPP = Nothing:Set IDE= Nothing
If Disk0 <> "" Then DskP=Right(DskP0,Len(DskP0)-2):WScript.Echo Left(DskP0,1)&":"&vbTab& Disk0 &vbTab _
                  &vbCrLf&vbTab&"分区状态:"&Right(DskP0,Len(DskP0)-2)
If Disk1 <> "" Then DskP=DskP&" "&Right(DskP1,Len(DskP1)-2):WScript.Echo Left(DskP1,1)&":"&vbTab& Disk1 &vbTab _
                  &vbCrLf&vbTab&"分区状态:"&Right(DskP1,Len(DskP1)-2)
If Disk2 <> "" Then DskP=DskP&" "&Right(DskP2,Len(DskP2)-2):WScript.Echo Left(DskP2,1)&":"&vbTab& Disk2 &vbTab _
                  &vbCrLf&vbTab&"分区状态:"&Right(DskP2,Len(DskP2)-2)
If Disk3 <> "" Then DskP=DskP&" "&Right(DskP3,Len(DskP3)-2):WScript.Echo Left(DskP3,1)&":"&vbTab& Disk3 &vbTab _
                  &vbCrLf&vbTab&"分区状态:"&Right(DskP3,Len(DskP3)-2)
If Disk4 <> "" Then DskP=DskP&" "&Right(DskP4,Len(DskP4)-2):WScript.Echo Left(DskP4,1)&":"&vbTab& Disk4 &vbTab _
                  &vbCrLf&vbTab&"分区状态:"&Right(DskP4,Len(DskP4)-2)
If Disk5 <> "" Then DskP=DskP&" "&Right(DskP5,Len(DskP5)-2):WScript.Echo Left(DskP5,1)&":"&vbTab& Disk5 &vbTab _
                  &vbCrLf&vbTab&"分区状态:"&Right(DskP5,Len(DskP5)-2)
WScript.Echo vbCrLf&"请输入"&DskP&"中任意一个盘符"
stdInput = WScript.StdIn.Readline
stdInput=Left(UCase(stdInput),1)
If InStr(DskP,stdInput) Then Call Network(stdInput&":")
Sub Network(DskPs)
sNow=Now
Do
Dim A
Set A = WMI.ExecQuery("Select * from Win32_PerfRawData_PerfDisk_LogicalDisk Where Name = '"& DskPs &"'")
For Each B In A
    R1 = B.DiskReadBytesPersec
    W1 = B.DiskWriteBytesPersec
    If RA0 = "" Then RA0 = B.DiskReadBytesPersec Else RA1 = R1 End If
    If WA0 = "" Then WA0 = B.DiskWriteBytesPersec Else WA1 = W1 End If
Next
Set A = Nothing
WScript.Sleep(InputS)
Set A = WMI.ExecQuery("Select * from Win32_PerfRawData_PerfDisk_LogicalDisk Where Name = '"& DskPs &"'")
For Each B In A
    R2 = B.DiskReadBytesPersec
    W2 = B.DiskWriteBytesPersec
Next
Set A = Nothing
WScript.Echo "监控分区:" &DskPs &vbCrLf _
      &"实时读取:" & CheckSize((R2-R1)/Input) &"/s" &vbCrLf _
      &"实时写人:" & CheckSize((W2-W1)/Input) &"/s"&vbCrLf _
      &"脚本累计读取:" & CheckSize(RA1-RA0) &vbCrLf _
      &"脚本累计写入:" & CheckSize(WA1-WA0) &vbCrLf _
      &"开机累计读取:" & CheckSize(R1) &vbCrLf _
      &"开机累计写入:" & CheckSize(W1) &vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf&vbCrLf _
      &"已运行"&Ts\3600&"小时"&(Ts mod 3600)\60&"分钟"&(Ts mod 3600) mod 60&"秒"
Ts=DateDiff("s", sNow, Now)'Ts=TS+1
Loop
End Sub

Function CheckSize(SZ)
On Error Resume Next
If SZ => 1073741824 Then
   SZ = FormatNumber(Round(SZ/1073741824,2))&" GB"
   ElseIf SZ => 1048576 Then
   SZ = FormatNumber(Round(SZ/1048576,2))&" MB"
   ElseIf SZ => 1024 Then
   SZ = FormatNumber(Round(SZ/1024,2))&" KB"
Else
   SZ = "0"&FormatNumber(Round(SZ/1024,2)) & " KB"
End If
CheckSize=Right("      " & SZ,10)
End Function

标签:
硬盘读写,分区读写

神剑山庄资源网 Design By www.hcban.com
神剑山庄资源网 免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
神剑山庄资源网 Design By www.hcban.com

评论“VBS 硬盘读写统计(分区读写统计)”

暂无VBS 硬盘读写统计(分区读写统计)的评论...

《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线

暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。

艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。

《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。