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-23 04:57
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » How to display the used space and free space of partitions in pure DOS using batch processing? View 2,991 Replies 18
Original Poster Posted 2008-11-05 20:44 ·  中国 陕西 西安 电信
初级用户
Credits 37
Posts 14
Joined 2008-02-17 16:00
18-year member
UID 110839
Gender Male
Status Offline

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 ]
Floor 2 Posted 2008-11-05 21:22 ·  中国 安徽 马鞍山 联通
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
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.
Windows 一键还原
http://www.yjhy.com
Floor 3 Posted 2008-11-05 22:25 ·  中国 上海 虹口区 电信
金牌会员
★★★★
Credits 4,639
Posts 2,239
Joined 2005-01-30 00:00
21-year member
UID 35785
Gender Male
Status Offline
Search for the keyword "remaining space" in this section, there must be an answer.
Floor 4 Posted 2008-11-06 04:21 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Floor 5 Posted 2008-11-06 20:52 ·  中国 陕西 西安 电信
初级用户
Credits 37
Posts 14
Joined 2008-02-17 16:00
18-year member
UID 110839
Gender Male
Status Offline
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 ]
Floor 6 Posted 2008-11-07 09:52 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
How does "no good" manifest itself?
Floor 7 Posted 2008-11-07 18:01 ·  中国 上海 虹口区 电信
中级用户
★★
Credits 248
Posts 126
Joined 2008-05-30 17:18
18-year member
UID 120118
Gender Male
Status Offline
@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...
Floor 8 Posted 2008-11-07 18:17 ·  中国 安徽 马鞍山 联通
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
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.
Windows 一键还原
http://www.yjhy.com
Floor 9 Posted 2008-11-08 20:26 ·  中国 江西 南昌 电信
新手上路
Credits 8
Posts 4
Joined 2008-10-04 22:35
17-year member
UID 127443
Gender Male
Status Offline
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
)
Floor 10 Posted 2008-11-09 11:49 ·  中国 安徽 马鞍山 联通
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
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.
Windows 一键还原
http://www.yjhy.com
Floor 11 Posted 2008-11-09 16:58 ·  中国 安徽 马鞍山 联通
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
pqdi (PowerQuest Drive Image) has this function, just a bit larger in size.
Just deal with it a little by yourself.


Windows 一键还原
http://www.yjhy.com
Floor 12 Posted 2008-11-15 13:27 ·  中国 陕西 西安 电信
初级用户
Credits 37
Posts 14
Joined 2008-02-17 16:00
18-year member
UID 110839
Gender Male
Status Offline

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
Floor 13 Posted 2008-11-16 13:20 ·  中国 江西 南昌 电信
初级用户
Credits 61
Posts 22
Joined 2008-10-19 17:15
17-year member
UID 128768
Gender Male
Status Offline
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.
Floor 14 Posted 2008-11-16 16:11 ·  中国 安徽 马鞍山 联通
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
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.
Windows 一键还原
http://www.yjhy.com
Floor 15 Posted 2008-11-16 16:13 ·  中国 安徽 马鞍山 联通
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
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.
Windows 一键还原
http://www.yjhy.com
Forum Jump: