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%
)
注:源文件
运行结果: