hta查看磁盘空间的脚本(shell脚本计算磁盘容量)快来看

随心笔谈1年前 (2023)发布 admin
153 0

磁盘空间查看脚本

     applicationname=”磁盘空间查看脚”     

     border=”dialog”

     borderstyle=”normal”

     caption=”yes”

     contextmenu=”no”

     maximizebutton=”no”

     minimizebutton=”yes”

     navigable=”no”

     scroll=”yes”

     selection=”no”

     showintaskbar=”yes”

     singleinstance=”yes”

     sysmenu=”yes”

     version=”1.0″

     windowstate=”normal”

>

window.resizeTo 500, 420

     ileft=(window.screen.width-500)/2

     itop=(window.screen.height-420)/2         

     window.moveTo ileft,itop                             

Sub Window_onLoad 

     GetDiskSpace 

End Sub

Sub GetDiskSpace

Const HARD_DISK = 3

Const Size = 1048576

strComputer = “.”

Set objWMIService = GetObject(“winmgmts:” _

     & “{impersonationLevel=impersonate}!\” & strComputer & “\root\cimv2”)

Set colDisks = objWMIService.ExecQuery _

     (“Select * from Win32_LogicalDisk Where DriveType = ” & HARD_DISK & “”)

     strHTML = ”
”         

                     strHTML = strHTML & “”

             strHTML = strHTML & “ ” & “分区” & “

             strHTML = strHTML & “ ” & “容量” & “

             strHTML = strHTML & “ ” & “已用” & “

             strHTML = strHTML & “ ” & “未用” & “

             strHTML = strHTML & “ ” & “空闲” & “

For Each objDisk In colDisks     

intFreeSpace = objDisk.FreeSpace/Size

intTotalSpace = objDisk.Size/Size

pctFreeSpace = intFreeSpace/Size/ intTotalSpace/Size

infFuLin = intTotalSpace-intFreeSpace

DeviceID = objDisk.DeviceID

             strHTML = strHTML & “”

             strHTML = strHTML & “” & DeviceID & “”

             strHTML = strHTML & “” & FormatNumber(intTotalSpace,2,-1,-1,0) & “”

             strHTML = strHTML & “ ” & FormatNumber(infFuLin,2,-1,-1,0) & “”

             strHTML = strHTML & “ ” & FormatNumber(intFreeSpace,2,-1,-1,0) & “”

             strHTML = strHTML & “” & FormatPercent(intFreeSpace/intTotalSpace) & “”

Next

strHTML = strHTML & “”

DataArea.InnerHTML = strHTML

End Sub

磁盘空间查看脚本

     显示各磁盘分区使用情况(/MB)

保存为hta文件.

© 版权声明

相关文章