HTA to view disk space script _hta

Source: Internet
Author: User
<title> disk space View scripts </title>
Applicationname= "Disk space View Foot"
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>" & "Partition" & "</b>&lt ;/td> "
strHTML = strhtml & "<td width=110px align=center><font size=2><b>" & "Capacity &" </b>&lt ;/td> "
strHTML = strhtml & "<td width=110px align=center><font size=2><b>" & "used" & "</b>&lt ;/td> "
strHTML = strhtml & "<td width=110px align=center><font size=2><b>" & Unused "&" </b>&lt ;/td> "
strHTML = strhtml & "<td width=110px align=center><font size=2><b>" & Idle "&" </b>&lt ;/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& gt; "
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>


<body>
<!--HTML goes here-->
<table align=center width=95%><font color= "#C63358" ><b> disk space View script </b></font><br >
<font size= "2" > Display disk partition usage (<font color= "#FF0000" >/MB</font>) </font></font></ Table>
<body bgcolor= "#99CCFF" >
<span id = "DataArea" ></span>
</body>
Save as an HTA file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.