find for /f 分割字符串 bat

@Echo off
::总用例数
For /f "tokens=2" %%i in ('Type bat.txt^|Find "Ran"') do (
Echo %%i
set totalTests=%%i
echo %totalTests%
)

::失败用例数
For /f "tokens=2" %%i in ('Type bat.txt^|Find "Failure"') do (
Echo %%i
set failTests=(%%i)
::echo %failTests%
::echo %failTests:~-2,1%
set failTests=%failTests:~-2,1%
echo %failTests%
)

注:源文件

运行结果:

 

posted @ 2018-01-13 00:29  think的海角  阅读(197)  评论(0编辑  收藏  举报