hta查看磁盘空间的脚本
发布日期:2021-12-23 00:29 | 文章来源:源码之家
<html>
<head>
<title>磁盘空间查看脚本</title>
<hta:application
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"
>
<scriptlanguage="vbscript">
<!--Insertcode,subroutines,andfunctionshere-->
window.resizeTo500,420
ileft=(window.screen.width-500)/2
itop=(window.screen.height-420)/2
window.moveToileft,itop SubWindow_onLoad
GetDiskSpace
EndSub
SubGetDiskSpace
ConstHARD_DISK=3
ConstSize=1048576
strComputer="."
SetobjWMIService=GetObject("winmgmts:"_
&"{impersonationLevel=impersonate}!\\"&strComputer&"\root\cimv2")
SetcolDisks=objWMIService.ExecQuery_
("Select*fromWin32_LogicalDiskWhereDriveType="&HARD_DISK&"")
strHTML="<tablealign=centerwidth=95%borderColor=#698cc2border='1'cellSpacing='0'cellpadding='1'>"
strHTML=strHTML&"<tr>"
strHTML=strHTML&"<tdwidth=110pxalign=center><fontsize=2><b>"&"分区"&"</b></td>"
strHTML=strHTML&"<tdwidth=110pxalign=center><fontsize=2><b>"&"容量"&"</b></td>"
strHTML=strHTML&"<tdwidth=110pxalign=center><fontsize=2><b>"&"已用"&"</b></td>"
strHTML=strHTML&"<tdwidth=110pxalign=center><fontsize=2><b>"&"未用"&"</b></td>"
strHTML=strHTML&"<tdwidth=110pxalign=center><fontsize=2><b>"&"空闲"&"</b></td>"
ForEachobjDiskIncolDisks
intFreeSpace=objDisk.FreeSpace/Size
intTotalSpace=objDisk.Size/Size
pctFreeSpace=intFreeSpace/Size/intTotalSpace/Size
infFuLin=intTotalSpace-intFreeSpace
DeviceID=objDisk.DeviceID
strHTML=strHTML&"<tr>"
strHTML=strHTML&"<tdwidth=110pxalign=center>"&DeviceID&"</td>"
strHTML=strHTML&"<tdwidth=110pxalign=right>"&FormatNumber(intTotalSpace,2,-1,-1,0)&"</td>"
strHTML=strHTML&"<tdwidth=110pxalign=right><fontcolor=#DB2C00>"&FormatNumber(infFuLin,2,-1,-1,0)&"</td>"
strHTML=strHTML&"<tdwidth=110pxalign=right><fontcolor=#008080>"&FormatNumber(intFreeSpace,2,-1,-1,0)&"</td>"
strHTML=strHTML&"<tdwidth=110pxalign=right>"&FormatPercent(intFreeSpace/intTotalSpace)&"</td>" Next
strHTML=strHTML&"</table>"
DataArea.InnerHTML=strHTML
EndSub
</script>
</head>
<body>
<!--HTMLgoeshere-->
<tablealign=centerwidth=95%><fontcolor="#C63358"><b>磁盘空间查看脚本</b></font><br>
<fontsize="2">显示各磁盘分区使用情况(<fontcolor="#FF0000">/MB</font>)</font></font></table>
<bodybgcolor="#99CCFF">
<spanid="DataArea"></span>
</body>
</html>
保存为hta文件.
<head>
<title>磁盘空间查看脚本</title>
<hta:application
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"
>
<scriptlanguage="vbscript">
<!--Insertcode,subroutines,andfunctionshere-->
window.resizeTo500,420
ileft=(window.screen.width-500)/2
itop=(window.screen.height-420)/2
window.moveToileft,itop SubWindow_onLoad
GetDiskSpace
EndSub
SubGetDiskSpace
ConstHARD_DISK=3
ConstSize=1048576
strComputer="."
SetobjWMIService=GetObject("winmgmts:"_
&"{impersonationLevel=impersonate}!\\"&strComputer&"\root\cimv2")
SetcolDisks=objWMIService.ExecQuery_
("Select*fromWin32_LogicalDiskWhereDriveType="&HARD_DISK&"")
strHTML="<tablealign=centerwidth=95%borderColor=#698cc2border='1'cellSpacing='0'cellpadding='1'>"
strHTML=strHTML&"<tr>"
strHTML=strHTML&"<tdwidth=110pxalign=center><fontsize=2><b>"&"分区"&"</b></td>"
strHTML=strHTML&"<tdwidth=110pxalign=center><fontsize=2><b>"&"容量"&"</b></td>"
strHTML=strHTML&"<tdwidth=110pxalign=center><fontsize=2><b>"&"已用"&"</b></td>"
strHTML=strHTML&"<tdwidth=110pxalign=center><fontsize=2><b>"&"未用"&"</b></td>"
strHTML=strHTML&"<tdwidth=110pxalign=center><fontsize=2><b>"&"空闲"&"</b></td>"
ForEachobjDiskIncolDisks
intFreeSpace=objDisk.FreeSpace/Size
intTotalSpace=objDisk.Size/Size
pctFreeSpace=intFreeSpace/Size/intTotalSpace/Size
infFuLin=intTotalSpace-intFreeSpace
DeviceID=objDisk.DeviceID
strHTML=strHTML&"<tr>"
strHTML=strHTML&"<tdwidth=110pxalign=center>"&DeviceID&"</td>"
strHTML=strHTML&"<tdwidth=110pxalign=right>"&FormatNumber(intTotalSpace,2,-1,-1,0)&"</td>"
strHTML=strHTML&"<tdwidth=110pxalign=right><fontcolor=#DB2C00>"&FormatNumber(infFuLin,2,-1,-1,0)&"</td>"
strHTML=strHTML&"<tdwidth=110pxalign=right><fontcolor=#008080>"&FormatNumber(intFreeSpace,2,-1,-1,0)&"</td>"
strHTML=strHTML&"<tdwidth=110pxalign=right>"&FormatPercent(intFreeSpace/intTotalSpace)&"</td>" Next
strHTML=strHTML&"</table>"
DataArea.InnerHTML=strHTML
EndSub
</script>
</head>
<body>
<!--HTMLgoeshere-->
<tablealign=centerwidth=95%><fontcolor="#C63358"><b>磁盘空间查看脚本</b></font><br>
<fontsize="2">显示各磁盘分区使用情况(<fontcolor="#FF0000">/MB</font>)</font></font></table>
<bodybgcolor="#99CCFF">
<spanid="DataArea"></span>
</body>
</html>
保存为hta文件.
版权声明:本站文章来源标注为YINGSOO的内容版权均为本站所有,欢迎引用、转载,请保持原文完整并注明来源及原文链接。禁止复制或仿造本网站,禁止在非www.yingsoo.com所属的服务器上建立镜像,否则将依法追究法律责任。本站部分内容来源于网友推荐、互联网收集整理而来,仅供学习参考,不代表本站立场,如有内容涉嫌侵权,请联系alex-e#qq.com处理。
相关文章