![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-10-24 03:19 |
47,815 topics / 349,928 posts / today 1 new / 48,287 members |
| DOS批处理 & 脚本技术(批处理室) » [Closed] How to display the remaining space of a disk? |
| Printable Version 22,250 / 46 |
| Floor31 willsort | Posted 2006-06-11 18:54 |
| 元老会员 Posts 1,512 Credits 4,432 | |
|
Re namejm:
It's a pity there's no Win2000 environment, so I can't test. The targeted solution needs you to detail the error message. Currently, the way I can think of is to remove find, and it works under CMD@WinXP: |
|
| Floor32 namejm | Posted 2006-06-11 20:08 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
When using the method of intercepting the last few characters to right-align the display of the disk volume label name and remaining space, the following incorrect format occurs (it can be formatted correctly when the volume label name is all in English). What is the reason?
The code and picture are as follows [ Last edited by willsort on 2006-6-12 at 19:31 ] Attachments error1.jpg (37.38 KiB) |
|
| Floor33 willsort | Posted 2006-06-11 20:23 |
| 元老会员 Posts 1,512 Credits 4,432 | |
|
Re namejm:
Because NT internally uses Unicode encoding, and one characteristic of Unicode characters is that "English and Chinese characters with different display widths have the same byte length and character length". This problem is relatively difficult to solve. The alternative solutions are nothing more than ensuring that no Chinese characters appear (that is, not displaying the volume label), or following my original suggestion of not using borders and moving the volume label column to the back. |
|
| Floor34 namejm | Posted 2006-06-11 21:03 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
It's really that you can't have both fish and bear's paws! :(
|
|
| Floor35 willsort | Posted 2006-06-12 19:27 |
| 元老会员 Posts 1,512 Credits 4,432 | |
|
Re: namejm:
Now, some schemes to align Chinese characters or other multi-byte characters are thought of. If it can be ensured that the displayed variable string only has Chinese characters, when padding variables, blank Chinese characters (such as full-width spaces in full-width state) can be used instead of ordinary spaces; Otherwise, it is necessary to judge the display width of the variable string. In the default Chinese environment, it can be understood as judging the byte length of the variable string in the local encoding (ANSI). Regarding this point, the current scheme is to generate a temporary file (using ANSI encoding by default), and determine the variable length according to the file length. The code is as follows But it still cannot align the overly long volume labels of NTFS. So I still suggest not insisting on adopting certain special character arrangement methods. There are many alternative schemes. For example, the volume label can be written in the front, and the drive letter will be followed by a pair of parentheses immediately after the volume label, as shown in "My Computer". And displaying changing strings in the border will always have the hidden danger of misaligned borders, and it also affects the readability of the code itself. Good typesetting effects can also be achieved by using other methods without using borders. In addition, the volume of the picture attachment is too large, and only one is left for illustration; in addition, the screenshot of the CMD window using a 16-color GIF will be much smaller in size, and the effect will not be too distorted. DrvSpace.cmd [ Last edited by willsort on 2006-6-12 at 19:34 ] |
|
| Floor36 namejm | Posted 2006-06-12 23:13 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
Thanks to willsort, I have slightly modified the code and incorporated it into my file backup script. Although there are still potential risks, once it's published, more people will try to figure it out, which is better than doing nothing.
I just posted a few pictures and didn't notice the impact of image format and color quality on the image size. I will pay attention to posting pictures that are as small as possible but still relatively clear in the future. |
|
| Floor37 willsort | Posted 2006-06-14 16:51 |
| 元老会员 Posts 1,512 Credits 4,432 | |
|
───────────────── Moderation Record ───────────────── Executor: Will Sort Operation: Merge thread {21183} The formatting error occurred through the method of intercepting characters -> Posts 32~36 Description: The operated thread has a direct context connection with this thread ───────────────── Moderation Record ───────────────── |
|
| Floor38 mobo | Posted 2006-09-19 08:41 |
| 初级用户 Posts 30 Credits 73 | |
|
::View logicaldisk [Logical Disk] summary information.bat:
::---------BY MOBO in 2006-09-18 wmic logicaldisk list brief /format:hform >logicaldisk.htm |
|
| Floor39 electronixtar | Posted 2006-09-19 08:56 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
Han~~Nowadays, it's all about WMIC~~
|
|
| Floor40 namejm | Posted 2006-09-19 09:40 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
Originally posted by electronixtar at 2006-9-19 08:56: Hehe, it seems that electronixtar is quite familiar with WMIC. I want to ask what are the advantages and disadvantages of WMIC and CMD respectively. |
|
| Floor41 electronixtar | Posted 2006-09-19 10:03 |
| 铂金会员 Posts 2,672 Credits 7,493 | |
|
cmd is close to bat, while wmic is close to wbem, that's it~~
Actually, I don't know much about it~~ Just heard about it~~ BagPipe is an expert, but he doesn't post threads~~ Actually, Windows is becoming more and more like UNIX~~ [ Last edited by electronixtar on 2006-9-19 at 10:07 ] |
|
| Floor42 zouzhxi | Posted 2006-09-22 07:56 |
| 中级用户 Posts 177 Credits 430 From 广东深圳 | |
|
If you want to display the total size of the hard disk, how to write...
|
|
| Floor43 HUNRYBECKY | Posted 2007-01-21 10:26 |
| 银牌会员 Posts 442 Credits 1,179 | |
|
If DOS supports floating-point operations, then the following method can be used to obtain disk space:
Unfortunately, an error is prompted because floating-point operations are not supported. |
|
| Floor44 HUNRYBECKY | Posted 2007-01-21 10:43 |
| 银牌会员 Posts 442 Credits 1,179 | |
|
Just now studied, modifying the above code can achieve a disguised floating-point calculation.
|
|
| Floor45 HUNRYBECKY | Posted 2007-01-21 10:47 |
| 银牌会员 Posts 442 Credits 1,179 | |
|
When modifying, I found that the FOR command actually supports calling variables as the SET set, so there's no need to generate temporary files anymore.
I'm sorry, I'm not very familiar with FOR and have been using it poorly all the time [ Last edited by HUNRYBECKY on 2007-1-21 at 11:06 AM ] |
|
| Prev 1 2 3 4 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |