set file=
"test.cmd"
set maxbytesize=
1000
FOR /F
"usebackq"
%%A IN (
'%file%'
) DO set
size
=%%~zA
if
%
size
% LSS %maxbytesize% (
echo.File is ^< %maxbytesize% bytes
) ELSE (
echo.File is ^>= %maxbytesize% bytes
)
delfile.bat:
FOR %%F IN ("C:\abc\a*b") DO (IF %%~zF LSS 1 del %%F)
如果要用另一個bat去呼叫,前面不用加 call
EQU – 等於
NEQ – 不等於
LSS – 小於
LEQ – 小於或等於
GTR – 大於
GEQ – 大於或等於
參考:http://fly-dolphin.blogspot.com/2012/02/blog-post.html
http://white5168.blogspot.com/2012/09/batch-if.html#.W2lDiNIzbIU
http://kukuso1983.blogspot.com/2010/09/0-setp1.html