标题 | 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 width=95% bordercolor=#698cc2 border='1' cellspacing='0' cellpadding='1'> strhtml = strhtml & <tr> strhtml = strhtml & <td width=110px><font size=2><b> & 分区 & </b></td> strhtml = strhtml & <td width=110px><font size=2><b> & 容量 & </b></td> strhtml = strhtml & <td width=110px><font size=2><b> & 已用 & </b></td> strhtml = strhtml & <td width=110px><font size=2><b> & 未用 & </b></td> strhtml = strhtml & <td width=110px><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> & 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 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文件. |
随便看 |
|
在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。