windows - Batch File Store Line Variables And Sum Them Up -
my input file count.txt contains following:
] /count 1 ] /count 2
i trying add numeric characters @ end of each line , store file or store variable. not able following batch file script:
setlocal enabledelayedexpansion set count=0 /f "tokens=3 delims= " %%i in ('findstr count count.txt') ( set /a count=%%i + %count% echo !count! > finalcount.txt ) endlocal
the output getting 2.
please help.
try this:
@echo off &setlocal enabledelayedexpansion set count=0 (for /f "tokens=3" %%i in ('findstr "count" count.txt') ( set /a count+=%%i echo !count! ))> finalcount.txt
Comments
Post a Comment