原因:在第578行行首有连续51个空字符(00),重新保存后转成51个空格符(20)。
解决:more命令自动将00空字符转成换行(空行)
可以使用下面的代码处理:
@echo off
for /f "delims==" %%a in ('type B12.txt^|more') do (
if /i "%%a"=="PASS" set/a P+=1
if /i "%%a"=="FAIL" set/a F+=1
)
echo.%p%和%F%
pause
不能使用下面的代码,因为将导致P被少计算:
@echo off
for /f "delims==" %%a in ('type B12.txt') do (
if /i "%%a"=="PASS" set/a P+=1
if /i "%%a"=="FAIL" set/a F+=1
)
echo.%p%和%F%
pause
或
@echo off
for /f "delims==" %%a in ('findstr .* B12.txt') do (
if /i "%%a"=="PASS" set/a P+=1
if /i "%%a"=="FAIL" set/a F+=1
)
echo.%p%和%F%
pause
Last edited by Hanyeguxing on 2010-5-9 at 16:55 ]