中国DOS联盟论坛

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-08-15 14:19
47,813 topics / 349,903 posts / today 1 new / 48,257 members
DOS疑难解答 & 问题讨论 (解答室) » How to display the used space and free space of partitions in pure DOS using batch processing?
Printable Version  3,244 / 18
Floor1 sanxiao88 Posted 2008-11-05 20:44
初级用户 Posts 14 Credits 37

How to display the remaining space and used space of partitions in pure DOS, that is, under pure DOS 7.1 or DOS 6.22, not in the DOS window of XP, using batch processing? Including FAT32 partitions and NTFS partitions. Which expert or master can do it?

I know that in the DOS of XP, it can be like this:

@echo off
cls
setlocal EnableDelayedExpansion
echo.
echo.
echo ╔══════════════════════════════╗
echo ║ Disk Partitions Disk Volume Name Remaining Space (MB) ║
echo ║ _____________________________________________________ ║
for %%d in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
if exist %%d:\nul (
for /f "tokens=3" %%z in ('dir /-c %%d:\') do set freesize=%%z
set /a freesize=!freesize:~0,-3!/1049>nul
set freesize= !freesize!
set freesize=!freesize:~-9!
for /f "tokens=3*" %%v in ('vol %%d:') do set volume=%%w
set volume= !volume!
set volume=!volume:~-20!
echo ║ %%d: !volume! !freesize! ║
)
)
echo ╚══════════════════════════════╝
pause>nul


[ Last edited by sanxiao88 on 2008-11-5 at 20:55 ]
Floor2 lianjiang2004 Posted 2008-11-05 21:22
金牌会员 Posts 1,884 Credits 3,946
It's not that simple under DOS. You can only look for some one-click tools that have this function and check the scripts inside. 99% of the time, no one will specifically write a script for you.
Floor3 DOSforever Posted 2008-11-05 22:25
金牌会员 Posts 2,239 Credits 4,639
Search for the keyword "remaining space" in this section, there must be an answer.
Floor4 HAT Posted 2008-11-06 04:21
版主 Posts 5,017 Credits 9,023
Floor5 sanxiao88 Posted 2008-11-06 20:52
初级用户 Posts 14 Credits 37
I checked the link on the 4th floor, but it doesn't work! However, I still want to thank you all!

Additionally, does anyone have the GET.EXE small program? Let me try this:

get k c:
strings free=div %get%,1024

[ Last edited by sanxiao88 on 2008-11-6 at 20:53 ]
Floor6 HAT Posted 2008-11-07 09:52
版主 Posts 5,017 Credits 9,023
How does "no good" manifest itself?
Floor7 jh1688 Posted 2008-11-07 18:01
中级用户 Posts 126 Credits 248
@echo off
:mini_BEGIN
if exist mini_dd.txt del mini_dd.txt
minito /nohp /p /ifs>mini_dd.txt
strings lines=LINESIZE mini_dd.txt
if %lines%#==0# goto fail
strings lines=add %lines%,1
set line=1
echo Hard disk information:
:mini
strings line=add %line%,1
if %line%#==%lines%# goto mini_1
strings lined=read mini_dd.txt,%line%
strings row1=left %lined%,3
strings row3=mid %lined%,8,2
strings row5=mid %lined%,19,3
strings row7=right %lined%,7
if %row5%#==YES# set actp=%row1%
set lastp=%row1%
set lastd=%row3%
set lastk=%row7%
if not %lined%#==# echo %lined%
goto mini

:mini_1
echo.
echo Please confirm the recognition result according to the hard disk information displayed above.
echo.
echo Automatic recognition result:
echo Active partition is: %actp%
echo Last partition is: %lastp%
echo The drive letter corresponding to the last partition is: %lastd%
echo The available space of the last partition is: %lastk%Mb
echo.
if exist mini_dd.txt del mini_dd.txt
goto exit

:fail
cls
echo.
echo Sorry, the software used by this tool failed to obtain valid hard disk information.
echo.
if exist mini_dd.txt del mini_dd.txt
:exit

The third-party DOS tools used here can be found in this forum. Please ask the thread starter to search for them by themselves...
Floor8 lianjiang2004 Posted 2008-11-07 18:17
金牌会员 Posts 1,884 Credits 3,946
Originally posted by jh1688 at 2008-11-7 18:01:
@echo off
:mini_BEGIN
if exist mini_dd.txt del mini_dd.txt
minito /nohp /p /ifs>mini_dd.txt
strings lines=LINESIZE mini_dd.txt
if %lines%#==0# goto fail
strings lines=add %lines%,1
set li ...


This method cannot handle the free space of NTFS partitions.
Floor9 jx1988020488 Posted 2008-11-08 20:26
新手上路 Posts 4 Credits 8
Display remaining space

for %%a in (c: d: e: f:) do (
for /f "tokens=3" %%b in ('dir %%a^|find "Available bytes"') do echo %%b bytes>>123.txt
)
Floor10 lianjiang2004 Posted 2008-11-09 11:49
金牌会员 Posts 1,884 Credits 3,946
Originally posted by jx1988020488 at 2008-11-8 20:26:
Display remaining space

for %%a in (c: d: e: f:) do (
for /f "tokens=3" %%b in ('dir %%a^|find "Available bytes"') do echo %%b bytes>>123.txt
)


Can it run in pure DOS? Hehe.
Please see the owner's requirements clearly.
The owner already has it under cmd.
Floor11 lianjiang2004 Posted 2008-11-09 16:58
金牌会员 Posts 1,884 Credits 3,946
pqdi (PowerQuest Drive Image) has this function, just a bit larger in size.
Just deal with it a little by yourself.


Floor12 sanxiao88 Posted 2008-11-15 13:27
初级用户 Posts 14 Credits 37

Maybe I didn't express it clearly. So far, there isn't a very suitable answer. Here, I will describe my requirements in detail again, hoping that experts can give guidance, and also hoping that more people will participate in the discussion, even if it's just to start a discussion. Thank you! The topic requirements are:
1.Under pure DOS, that is, after booting with a DOS 7.1 or DOS 6.22 boot disk, A:\>, not executing in the cmd window of XP or win2000;
2.Use batch processing including with the help of other third-party small tool software to obtain the values of the remaining space and used space of each partition (including FAT32 partitions and NTFS partitions)? Including FAT32 partitions and NTFS partitions. I already have many under cmd.


E:\DOWNLOAD\网络下载\0.jpg
Floor13 youkaib Posted 2008-11-16 13:20
初级用户 Posts 22 Credits 61
Just add an external command. Specifically, write it like this.

@echo off
echo Please list the drives:
fsutil fsinfo drives
echo Do you want to query the drive space
set /p a=(y/n):
if "%a%"=="n" exit
echo Listing the disk space of drives:
for %%i in (c: d: e: f: g: h: i: j: k:) do (
echo %%i usage is:
fsutil volume diskfree %%i
echo.
)
echo Operation completed!
echo Welcome to join QQ group 74487678. Many experts are looking forward to your joining.
pause >nul
This is clearer, much more convenient than using your dir. But there is a defect, that is, it will report an error when encountering an unknown device. This needs to expand a few more statements before.
Floor14 lianjiang2004 Posted 2008-11-16 16:11
金牌会员 Posts 1,884 Credits 3,946
Originally posted by youkaib at 2008-11-16 13:20:
Just add an external command. Specifically, write like this.
@echo off
echo Please list the drives:
fsutil fsinfo drives
echo Do you want to query the drive space
set /p a=(y/n):
if "%a%"=="n" ...

Take a look at others' requirements. I already have multiple such scripts. Hehe.

Could it really be that you don't understand what DOS is?

1. In pure DOS, that is, after booting with a DOS 7.1 or DOS 6.22 boot disk, it's A:\>, not executing in the cmd window of XP or win2000;
2. Use batch processing including relying on other third-party small tool software to obtain the values of the remaining space and used space of each partition (including FAT32 partitions and NTFS partitions)? Including FAT32 partitions and NTFS partitions. I already have many under cmd.
Floor15 lianjiang2004 Posted 2008-11-16 16:13
金牌会员 Posts 1,884 Credits 3,946
The pqdi recommended by the 11th floor is a tool that can meet the requirements. It seems you still don't think highly of it, heh heh.
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023