Batch file to check the size and print the outout

Posted by OraR on Super User See other posts from Super User or by OraR
Published on 2014-05-26T19:51:04Z Indexed on 2014/05/26 21:35 UTC
Read the original article Hit count: 186

Filed under:

I am trying to make a batch file and that would check the size of f1.txt file and if the size is 1118 then no changes will be displayed if not the file has been changed.

@ECHO OFF
set maxbytesize=1118
set "filename=f1.txt"
for %%A in (%filename%) do echo.Size of "%%A" is %%~zA bytes 
if %%~zA==%maxbytesize% (
    echo "No Changes" 
    pause >nul
    exit
)
echo "Changes"
pause >nul
exit

Please can someone let me know any possible guidelines for the above. Thanks.

© Super User or respective owner

Related posts about batch