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 & “
strHTML = strHTML & “
strHTML = strHTML & “
strHTML = strHTML & “
strHTML = strHTML & “
Next
strHTML = strHTML & “”
DataArea.InnerHTML = strHTML
End Sub
显示各磁盘分区使用情况(/MB)
保存为hta文件.