Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions

https://stackoverflow.com/questions/13212033/get-windows-version-in-a-batch-file

10.0   Windows 10
6.3   Windows Server 2012
6.3   Windows 8.1   /!\
6.2   Windows 8   /!\
6.1   Windows 7   /!\
6.0   Windows Vista
5.2   Windows XP x64
5.1   Windows XP
5.0   Windows 2000
4.10   Windows 98

Function:

@ECHO OFF

for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j
if "%version%" == "10.0" set %1=WIN10
if "%version%" == "6.3" set %1=WIN8.1
if "%version%" == "6.2" set %1=WIN8
if "%version%" == "6.1" set %1=WIN7
if "%version%" == "6.0" set %1=WINVista

Test:

set myvar=
echo %myvar%
call C:\tmp\Win_Ver.cmd myvar
echo %myvar%
  • No labels