setlocal EnableDelayedExpansion cd /d D:\ for /F "tokens=1,* delims= " %%i in ('findstr "test " abc.h') do ( set "versionVar=%%~i" set "versionVal=%%~j" set test=%versionVal:~4,5% set /a "string=%%~j+1" ) I tried to search test string from file. Try to get 20 from the .h file in versionval variable and also try to get #define test in variable versionvar.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)