Skip to content

Instantly share code, notes, and snippets.

@Ruzzz
Created March 30, 2013 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ruzzz/5277606 to your computer and use it in GitHub Desktop.
Save Ruzzz/5277606 to your computer and use it in GitHub Desktop.
Read and return version of project from string #define VERSION "_VER_"
@echo off
rem Init
set ROOT_PATH=%~dp0..\..
rem get #define VERSION "_VER_"
for /f "tokens=* delims= " %%a in (%ROOT_PATH%\src\defs.h) do (
echo %%a | find "VERSION" > nul
if not errorlevel 1 set LINE=%%a
)
rem get "_VER_"
for /f "tokens=3 delims= " %%a in ('echo %LINE%') do (
set VERSION_QUOTE=%%a
)
rem get _VER_
set VERSION=%VERSION_QUOTE:~1,-1%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment