China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-28 05:07
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Please clarify the specific content of the "hta script" mentioned. As the current information is relatively limited, I need more details about the specific code or context of the hta script related to obtaining the exact values of used/unused space of all partitions to accurately translate and handle it. Please provide more relevant content. View 2,454 Replies 17
Original Poster Posted 2007-03-12 06:07 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
Today I found it online. Originally it was in GB, changed to MB, and the interface was slightly modified.

HTA script (with the extension hta)
<html>
<head>

<title>Disk Space View Script</title>

<hta:application
applicationname="Disk Space View Script"
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></td>"
strHTML = strHTML & "<td width=110px align=center><font size=2><b>" & "Capacity" & "</b></td>"
strHTML = strHTML & "<td width=110px align=center><font size=2><b>" & "Used" & "</b></td>"
strHTML = strHTML & "<td width=110px align=center><font size=2><b>" & "Unused" & "</b></td>"
strHTML = strHTML & "<td width=110px align=center><font size=2><b>" & "Free" & "</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>Disk Space View Script</b></font><br>
<font size="2">Display the usage of each disk partition (<font color="#FF0000">/MB</font>)</font></font></table>
<body bgcolor="#99CCFF">
<span id = "DataArea"></span>
</body>
</html>


The attachment is the original author's code file

[ Last edited by zh159 on 2007-3-12 at 10:46 AM ]
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
lxmxn +4 2007-03-12 09:37
Attachments
自己修改的磁盘空间查看脚本界面.gif
原磁盘空间查看脚本.rar (1.54 KiB, Credits to download 1 pts, Downloads: 43)
Floor 2 Posted 2007-03-12 07:10 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
Sofa!
This is a good thing, thank you for sharing.
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 3 Posted 2007-03-12 07:14 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
This is displaying GB.
Attachments
snap.gif
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 4 Posted 2007-03-12 07:20 ·  中国 浙江 绍兴 诸暨市 电信
高级用户
★★★
Autowalk
Credits 845
Posts 375
Joined 2007-03-03 01:58
19-year member
UID 80606
Gender Male
Status Offline
Can such an effect be achieved using DOS commands + HTML instead of VB?
Floor 5 Posted 2007-03-12 08:06 ·  中国 安徽 马鞍山 电信
中级用户
★★
Credits 493
Posts 228
Joined 2007-02-16 00:38
19-year member
UID 79596
Gender Male
From 安徽
Status Offline
Let me take a look
Floor 6 Posted 2007-03-12 09:51 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline
  Make a simple WMIC one: (Applicable to Windows XP and above systems)

@echo off
wmic /output:a.html logicaldisk where "DriveType=3" get DeviceID,Size,FreeSpace,Description,FileSystem /format:htable.xsl
start a.html


[ Last edited by lxmxn on 2007-3-11 at 08:53 PM ]
Floor 7 Posted 2007-03-12 12:18 ·  中国 吉林 四平 联通
高级用户
★★★
Credits 859
Posts 413
Joined 2006-08-14 21:55
19-year member
UID 60532
Status Offline
Where is the a.html?
Floor 8 Posted 2007-03-13 03:26 ·  中国 北京 联通
银牌会员
★★★★
[b]看你妹啊[/b]
Credits 1,488
Posts 1,357
Joined 2006-05-20 12:00
20-year member
UID 55770
Status Offline
Originally posted by lxmxn at 2007-3-12 09:51:
  Let's make a simple WMIC one: (for Windows XP and above systems)

@echo off
wmic /output:a.html logicaldisk where "DriveType=3" get DeviceID,Size,FreeSp ...


:) It should be in the system32 folder, right?
Floor 9 Posted 2007-03-13 03:30 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline
Originally posted by anqing at 2007-3-11 23:18:
Where is a.html?

  It is in the directory where the batch file is located.
Floor 10 Posted 2007-03-13 04:03 ·  中国 广东 广州 番禺区 电信
中级用户
★★
脚本爱好者
Credits 238
Posts 93
Joined 2007-03-11 13:38
19-year member
UID 81417
Gender Male
From GZ
Status Offline
I think the original way of displaying GB is simple and easy to use. The method by lxmxn is simpler. I really admire your script technology. Can you create this information into a text in the current directory?
Floor 11 Posted 2007-03-13 04:11 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline
Originally posted by axi at 2007-3-12 15:03:
I think the original way of displaying GB is simple and easy to use. The method by lxmxn is simpler. I really admire your script technology. Can you create this information into a text in the current directory?


  There are multiple methods:

  Direct the generated information to a.txt:
  1、
wmic /output:a.txt logicaldisk where "DriveType=3" get DeviceID,Size,FreeSpace,Description,FileSystem

  2、
wmic logicaldisk where "DriveType=3" get DeviceID,Size,FreeSpace,Description,FileSystem>a.txt
Floor 12 Posted 2007-03-13 05:51 ·  中国 广东 广州 番禺区 电信
中级用户
★★
脚本爱好者
Credits 238
Posts 93
Joined 2007-03-11 13:38
19-year member
UID 81417
Gender Male
From GZ
Status Offline
Can the form height of the "disk space viewing script" be automatically adjusted according to the content?
Floor 13 Posted 2007-08-22 20:59 ·  中国 四川 成都 电信
新手上路
Credits 10
Posts 5
Joined 2006-11-22 03:52
19-year member
UID 71321
Gender Male
Status Offline
Does it support multiple hard drives?
Floor 14 Posted 2007-08-25 14:28 ·  中国 广东 广州 白云区 电信
初级用户
★★
Credits 132
Posts 59
Joined 2007-08-23 21:24
18-year member
UID 95705
Gender Male
From GuangZhou
Status Offline
29729.63MB is not very intuitive. It's more intuitive to be 17.1GB. After all, hard drives nowadays are often in the hundreds of GB range.
Floor 15 Posted 2007-11-28 14:26 ·  中国 上海 联通
新手上路
Credits 3
Posts 1
Joined 2007-11-28 13:55
18-year member
UID 104046
Gender Male
Status Offline
Forum Jump: