Batch – Return Major Build Version

email me

Command Line

FOR /f “tokens=1,2,3,4 delims=[.]” %a IN (‘ver’) DO ECHO %d


In Script

FOR /f “tokens=1,2,3,4 delims=[.]” %%a IN (‘ver’) DO SET wBuild=%%d
ECHO %wBuild%

 

Notes

for

if %wBuild% LSS 19041 exit

if %wBuild% LEQ 18362 exit

if %wBuild% EQU 18362 exit :: 1903
if %wBuild% EQU 17763 exit :: 1809
if %wBuild% EQU 17134 exit :: 1803
if %wBuild% EQU 16299 exit :: 1709
if %wBuild% EQU 15063 exit :: 1703

EQU – equal
NEQ – not equal
LSS – less than
LEQ – less than or equal