当前位置: 首页 > 图文教程 > 脚本技术 > Hta > hta查看磁盘空间的脚本

Hta
hta查看磁盘空间的脚本
HTA编辑HOST文件的脚本
hta实现的定时重启或关闭计算机的小工具
hta实现的二进制文件转换为文本
风讯注入exp(hta版)代码发布
学习正则帮手笨狼正则练习器
hta实现的笨狼XSLT练习器
hta实现的笨狼树状节点查看器
hta作品笨狼CSDN爬虫
hta(vbs)列目录树代码
适用于hta的Sleep函数
hta 定时关机重启实现代码
从 HTA 中启动应用程序
ASP 辅助工具(hta版)
hta编写的软件管理工具0.1(IE7.0测试通过)
exe转换16进制的html保存的hta实现代码
VBS脚本的GUI界面 HTA简明教程(网络搜集整理)
winXP下用VBS写的代码编辑器
扣代码工具 hta版
用hta实现的桌面漂浮flash

Hta 中的 hta查看磁盘空间的脚本


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-10   浏览: 51 ::
收藏到网摘: n/a

用hta实现的可以查看磁盘剩余空间的脚本 <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"
>

<script language="vbscript">
<!-- Insert code, subroutines, and functions here -->
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 = "<table align=center width=95% borderColor=#698cc2 border='1' cellSpacing='0' cellpadding='1'>"
strHTML = strHTML & "<tr>"
strHTML = strHTML & "<td width=110px align=center><font size=2><b>" & "分区" & "</b></td>"
strHTML = strHTML & "<td width=110px align=center><font size=2><b>" & "容量" & "</b></td>"
strHTML = strHTML & "<td width=110px align=center><font size=2><b>" & "已用" & "</b></td>"
strHTML = strHTML & "<td width=110px align=center><font size=2><b>" & "未用" & "</b></td>"
strHTML = strHTML & "<td width=110px align=center><font size=2><b>" & "空闲" & "</b></td>"

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 & "<tr>"
strHTML = strHTML & "<td width=110px align=center>" & DeviceID & "</td>"
strHTML = strHTML & "<td width=110px align=right>" & FormatNumber(intTotalSpace,2,-1,-1,0) & "</td>"
strHTML = strHTML & "<td width=110px align=right><font color=#DB2C00>" & FormatNumber(infFuLin,2,-1,-1,0) & "</td>"
strHTML = strHTML & "<td width=110px align=right><font color=#008080>" & FormatNumber(intFreeSpace,2,-1,-1,0) & "</td>"
strHTML = strHTML & "<td width=110px align=right>" & FormatPercent(intFreeSpace/intTotalSpace) & "</td>"
Next
strHTML = strHTML & "</table>"
DataArea.InnerHTML = strHTML
End Sub

</script>
</head>

<body>
<!-- HTML goes here -->
<table align=center width=95%><font color="#C63358"><b>磁盘空间查看脚本</b></font><br>
<font size="2">显示各磁盘分区使用情况(<font color="#FF0000">/MB</font>)</font></font></table>
<body bgcolor="#99CCFF">
<span id = "DataArea"></span>
</body>
</html>
保存为hta文件.