yipo
3/19/2016 - 5:20 PM

validate_version.bat

: cmd /c validate_version <major>.<minor>.<revision>(.| )<build_num>

@echo off

for /f "tokens=1-4 delims=. " %%a in ("%~1 %~2") do (
    call :validate_number "%%a"
    call :validate_number "%%b"
    call :validate_number "%%c"
    call :validate_number "%%d"
    echo %%a.%%b.%%c.%%d
    exit
)

exit 1

:validate_number
echo (%~1)| findstr /r "^([0-9][0-9]*)$" > nul
if errorlevel 1 exit 1
goto :eof