Navigation

8/21/2017

determing Windows version via BAT script

Need to determine which version of Windows on laptops via CMD file:



for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
 
ECHO   %version% 


@echo off
for /f "tokens=4-7 delims=[.] " %%i in ('ver') do 
     (if %%i==Version (set v=%%j.%%k) else (set v=%%i.%%j)) 
 
if %v% == "10.0" goto  Win10

if %v% == "6.1" goto  Win7


:Win7
echo   Windows 7
goto exit

:Win10
echo   Windows 10
goto exit


:exit
pause

No comments:

Post a Comment