Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Is there a possibility to check how big a disk is, and use the size to determine wich sub should run in a batch file.
ex. read the size of a disk a determine if it is bigger the 1.4mb and say this probably not a normal diskette are you sure you want to format

Sure, it's possible.
No time to write it, but
check the techniques on my pages.Ok here is one I wrote to check if a
file is 2KB. Maybe that will help
give you the idea.:: is2kb.bat
@ECHO off
IF "%1"=="ReCuRs[" GOTO recurs
IF "%1"=="" ECHO existing filename must be supplied
IF "%1"=="" GOTO end
IF not exist %1 ECHO existing filename must be supplied
IF not exist %1 GOTO end
IF exist enter.bat ECHO enter.bat in current
IF exist enter.bat GOTO end
PATH>%temp%.\respath.bat
PATH %temp%;%path%
SET siz=
SET sep=
SET tar=%1
DIR/A-D/W %1. |FIND " 1 ">%temp%.\result1.dat
ECHO.>>%temp%.\result1.dat
DATE %temp%.\result1.bat
ECHO IF "%%7"=="bytes" set siz=%%6> %temp%.\enter.bat
ECHO IF not "%%7"=="bytes" SET siz=%%6%%7>> %temp%.\enter.bat
FOR %%c IN (CALL DEL) do %%c %temp%.\result1.bat
DEL %temp%.\enter.bat
FOR %%c in (CALL DEL) do %%c %temp%.\respath.bat
ECHO %siz% |FIND "." >nul
IF not errorlevel 1 SET sep=.
ECHO ; |CHOICE.COM /C%siz%; >nul
IF not "%sep%"=="." IF errorlevel 6 ECHO %1 is larger then 2 Kb
IF not "%sep%"=="." IF errorlevel 6 GOTO end
IF not "%sep%"=="." IF errorlevel 1 IF not errorlevel 5 ECHO %1 is smaller than 2 Kb
IF not "%sep%"=="." IF errorlevel 1 IF not errorlevel 5 GOTO end
IF "%sep%"=="." IF errorlevel 7 ECHO %1 is larger then 2 Kb
IF "%sep%"=="." IF errorlevel 7 GOTO end
IF "%sep%"=="." IF errorlevel 2 IF not errorlevel 5 ECHO %1 is smaller than 2Kb
IF "%sep%"=="." IF errorlevel 2 IF not errorlevel 5 GOTO end
ECHO ; |CHOICE.COM/C;%siz%; %0;ReCuRs>%temp%.\parse1.bat
%temp%.\PARSE1.BAT:recurs
SHIFT 2
IF "%1"=="]?" GOTO end
FOR %%n in (3 4 5 6 7) do IF %%n==%1 ECHO %tar% is larger then 2 Kb
FOR %%n in (3 4 5 6 7) do IF %%n==%1 GOTO end
SHIFT 0
IF "%1"=="." SHIFT
IF not "%1"=="0" ECHO %tar% is larger then 2 Kb
IF not "%1"=="0" GOTO end
SHIFT 4
FOR %%n in (0 1 2 3 4) do IF %%n==%1 GOTO last
ECHO %tar% is larger than 2Kb
GOTO end
:last
SHIFT 8
FOR %%n in (0 1 2 3 4 5 6 7) do IF %%n==%1 ECHO %tar% is smaller than 2Kb
FOR %%n in (0 1 2 3 4 5 6 7) do IF %%n==%1 GOTO end
IF %1==8 ECHO %tar% is exactly 2Kb
IF not %1==8 ECHO %tar% is larger than 2Kb:end
SET siz=
SET tar=
SET sep=

I had forgotten I had already written a batch program to do this.http://home7.inet.tele.dk/batfiles/monthly/jan2001.htm

Hi. I was taking a look at the batch file, and was wondering...
is the following line (line 17 from batch) posted correctely?DATE %temp%.\result1.bat
Wouldn't it be something like
DATE [lessthan] %temp%.\result1.dat|FIND "1">%temp%.\result1.bat
Or am I wrong?
Could you Laurence please clear this to me?Thanks
-- SECRET_DOOM --

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |