home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Guide
/
c-cplusplus-interactive-guide.iso
/
c_ref
/
csource1
/
cenvid
/
diskfree.bat
< prev
next >
Wrap
DOS Batch File
|
1993-09-03
|
1KB
|
29 lines
@echo OFF
REM ********************************************************************
REM *** DiskFree.bat - Display how much disk space is available on a ***
REM *** drive, and set the DISK_FREE environment ***
REM *** variable to that amount. This batch file is ***
REM *** very specific to COMMAND.COM under MSDOS ***
REM *** version 5.0 and is not guaranteed to give ***
REM *** correct results in any other circumstance. ***
REM *** ***
REM *** Here's another method for free disk space for drive C: ***
REM *** CEnvi reg.dl=3;reg.ah=0x36;interrupt(0x21,reg); ***
REM *** DISKFREE=reg.cx * reg.ax * reg.bx; ***
REM ********************************************************************
if "%1" == "" GOTO SHOW_HOW
if not "%2"=="" GOTO SHOW_HOW
dir %1:\NUL | find "bytes free" | cenvi DISK_FREE = atol(gets()) / 1024
ECHO DRIVE %1 HAS %DISK_FREE% K-BYTES FREE
GOTO FINI
:SHOW_HOW
ECHO DiskFree.bat - Show how much disk space is available on a drive, in kilobytes,
ECHO and set DISK_FREE environment variable to that size
ECHO USAGE: DiskFree DriveLetter
ECHO Example: DiskFree C
GOTO FINI
:FINI