I have this text file:
NAME=MDF
VERSION=20140710
RELEASE_LIBRARY_DIRS=
DEBUG_LIBRARY_DIRS=
RELEASE_LIBRARIES=
DEBUG_LIBRARIES=
RELEASE_DEFINITIONS=
DEBUG_DEFINITIONS=
I want to parse out the version number and save it in a variable. Ive never done anything like this in batch and the for loops are confusing me. This is what I have so far. Mostly from another source.
@ECHO off
SET /P MYVAR=<MDFinfo.txt
ECHO MYVAR=%MYVAR%
FOR /f "tokens=1,2* delims==" %%I IN ( "%MYVAR%" ) DO (
ECHO LINE=%%I
ECHO RESULT=%%J
SET /A RESULT=%%I
)
ECHO The number is: %RESULT%
pause
This is Echoing the NAME and MDF but not the line I want. Also when result is printed at the end it comes out to be 0. Can someone please explain to me how the tokens and delims work? Also how can I pull out the version number. The text file cannot be changed.
Thanks