![]() |
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-10 16:01 |
47,811 topics / 349,897 posts / today 0 new / 48,255 members |
| DOS批处理 & 脚本技术(批处理室) » How to determine if the free space on drive D is greater than 1GB? |
| Printable Version 2,381 / 7 |
| Floor1 mp3down | Posted 2006-12-13 03:12 |
| 初级用户 Posts 14 Credits 43 | |
|
Please: How to determine if the free space on drive D is greater than 1GB? Thank you.
|
|
| Floor2 mp3down | Posted 2006-12-13 03:34 |
| 初级用户 Posts 14 Credits 43 | |
|
Supplement: It needs to run normally under pure DOS, thank you.
|
|
| Floor3 yusir0710 | Posted 2006-12-18 15:25 |
| 新手上路 Posts 2 Credits 6 | |
|
@ECHO OFF
setlocal EnableDelayedExpansion for /f "tokens=3" %%i in ('dir /-c D:\') do set freesize=%%i set /a freesize=!freesize:~0,-6!/1024>nul ECHO %freesize% set /a baseCapacity=1 PAUSE IF %freesize% GTR %baseCapacity% goto gtr ECHO The space is less than %baseCapacity%G pause exit :gtr ECHO The space is greater than %baseCapacity%G pause [ Last edited by yusir0710 on 2006-12-18 at 02:37 AM ] |
|
| Floor4 NaturalJ0 | Posted 2006-12-18 22:32 |
| 银牌会员 Posts 533 Credits 1,181 | |
|
The one upstairs is for use under CMD, and it can't be used in pure DOS. I haven't thought of how to judge in pure DOS for the time being.
|
|
| Floor5 redtek | Posted 2006-12-19 02:38 |
| 金牌会员 Posts 1,147 Credits 2,902 | |
|
This is interesting~:)
I wonder if Brother mp3down has found out what method they used in some tools like one-click recovery disks? Assembly... Function call 36H can obtain the free disk space, and then operate Debug with the prompt method to directly write assembly code, so that no temporary files can be generated. (Another: The above method can be realized without calling third-party tools) (Then continue to directly compare in Debug whether it is greater than 1G or less than 1G, call 4CH DOS function to return a flag number to ERRORLEVEL, and the batch processing will judge) (Theoretically completely achievable) The above is just a suggestion for you, I can't code~:) Brother can post to the "DOS Development Programming & Development Exchange (Development Room)" in the forum to ask what the principle code of directly operating Debug above is, maybe it can solve the urgent problem~:) |
|
| Floor6 lianjiang2004 | Posted 2006-12-19 02:49 |
| 金牌会员 Posts 1,884 Credits 3,946 | |
|
GMY's one-click GHOST does not itself judge the available space size of the partition where the backup is saved. Instead, it provides the reason based on the error file generated by GHOST when GHOST encounters an error.
|
|
| Floor7 lizaoyou | Posted 2007-02-09 22:53 |
| 中级用户 Posts 85 Credits 210 From 广东广州 | |
|
Implementing under DOS is relatively complicated. The following is an example of using batch to extend strings.com:
@echo off echo. set v= dir d:\|find "free">tmp strings s=read tmp,1 strings/p- s=mid %s%-9 strings/p- s=parse %s%-1 strings/p- s1=parse %s%-1-, strings/p- s2=parse %s%-2-, strings/p- s3=parse %s%-3-, strings v=sub %s1%%s2%%s3%,1024>unl if "%v%"=="" goto lss echo DiskFree ">" 1GB goto end :lss echo DiskFree "<" 1GB :end del tmp echo. [ Last edited by lizaoyou on 2007-2-9 at 09:55 AM ] |
|
| Floor8 nicesoft | Posted 2007-05-01 19:35 |
| 初级用户 Posts 47 Credits 98 | |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |