1.

Solve : verify file lenght into batch file?

Answer»

i NEED to verify if one FILE have dimension of 3056 byte before PROCESS it

if dimensio of file are different i need to stop process

thanks

ps. it's my first post so ... Hi All  in your batch, something like

if %~z1==3056 GoTo OK
Echo Error
GoTo :EOF
:OK
:: continue

%1 is the first param supplied to the batch and the ~z modifier returns the filesize in bytes

Grahamfor /F %%A in ("tps.bi_") do If %%~z1==3056 GoTo OK
Echo Error File Dimension
exit

:OK
...
...

file name are tps.bi_

this not work or i MAKE some wrong
for /F %%A in ("tps.bi_") do If %%~zA==3056 GoTo OK
Echo Error File Dimension
exit
 
K
...
...

this should work -- but why use a loop if there is only a single file ?
GrahamIf file.bin %~z1==3056 GoTo OK

echo Error File Dimension

goto warn

:OK
...
...

it's not work (i have try loop from one example)it's OK:

Quote

for /F %%A in ("tps.bi_") do If %%~zA==3056 GoTo OK

cls
color 0c
echo.
echo Error File LENGHT NOT 3056 byte
echo.
echo Errore Dimensione File diversa da 3056 byte
echo.
echo.
echo.
echo correct file size of tps.bi_
echo.
echo.
echo.
echo.
echo.
echo.
pause
exit

:OK
If tps.bi_ %%~zA==3056 GoTo OK


it's ok olso ...

i make some mistake  :-/

thanks


Discussion

No Comment Found