亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

VBS如何實現硬盤讀寫統計

發布時間:2021-10-12 10:16:47 來源:億速云 閱讀:120 作者:小新 欄目:開發技術

這篇文章主要為大家展示了“VBS如何實現硬盤讀寫統計”,內容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領大家一起研究并學習一下“VBS如何實現硬盤讀寫統計”這篇文章吧。

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

以上是“VBS如何實現硬盤讀寫統計”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業資訊頻道!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

vbs
AI

贺兰县| 达孜县| 封丘县| 岚皋县| 通渭县| 金乡县| 甘洛县| 绥化市| 四子王旗| 景谷| 卫辉市| 思茅市| 武平县| 青神县| 忻州市| 舞阳县| 富蕴县| 望江县| 巴中市| 新源县| 无锡市| 夏津县| 团风县| 周至县| 西安市| 柞水县| 府谷县| 丰都县| 津市市| 屏南县| 土默特右旗| 中阳县| 平遥县| 阿瓦提县| 同仁县| 儋州市| 灵山县| 象山县| 吉林市| 三亚市| 宁安市|