如果我的文件大小小于特定大小(在这种情况下,如果它等于零),我正在尝试将我的批处理文件设置为出错
我使用了与脚本的大部分内容相同的格式,但它失败了
:: Check size of input files
call "%DIR_BAT%\CreateLAFMessage.bat" "%~n0.bat-> %STEP_NBR% - check for size of LOM_AA_2.dat and LOM_AI.dat" %_LAF_MSG_DETAILS%
set ERROR_MSG="%DIR_IP_INTERFACES%\LOM_AA_2.dat" ZERO Byte File
set file="%DIR_IP_INTERFACES%\LOM_AA_2.dat"
set minbytesize=0
FOR /F "usebackq" %%A IN (%file%) DO set size=%%~zA
if %size% LSS %minbytesize% (
echo.File is ^> %minbytesize% bytes
) ELSE (
goto ON_ERROR
)
set ERROR_MSG="%DIR_IP_INTERFACES%\LOM_AI.dat" ZERO Byte File
set file="%DIR_IP_INTERFACES%\LOM_AI.dat"
FOR /F "usebackq" %%A IN (%file%) DO set size=%%~zA
if %size% LSS %minbytesize% (
echo.File is ^> %minbytesize% bytes
) ELSE (
goto ON_ERROR
)