The content of the version.cfg file is as follows:
project='XXX'
version_number='V01.01'
description=''
Write a bat script to read the versin.cfg file to obtain the value of version_number inside, the content is as follows:
set version_number="V01.03"
set key="version_number"
for /f "tokens=1,2 delims==" %%i in (version.cfg) do (
if "%%i"==%key% set version_number=%%j)
echo version_number is : %version_number%
pause
The execution results are as follows:
Note: If there are multiple key value assignments in the file, the final obtained value is the last key value in the file.