-{ a hewer of maps }-

Determine Windows Version

Who would have thought a simple question like "what version of windows am I running under?" would be so complicated?

This stub retrieves the number as a string. A complete working script which parses ver and responds accordingly is attached as winver2.cmd. For practical purposes you might be better off with Simon Sheppard's approach.

~~~~ {.prettyprint} @echo off for /f "tokens=2 delims=[]" %%x in ('ver') do set WINVER=%%x set WINVER=%WINVER:Version =% echo CMD version is %winver% ~~~~

A one liner for the major number (reg.exe not always available, XP and newer I think):

reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentVersion
References
Windows Version Table

Scraped from http://en.wikipedia.org/wiki/Microso...ne_of_releases

Product name

Current Version / Build

Windows 1.01

1.01

Windows 2.03

2.03

Windows 2.10

2.10

Windows 2.11

2.11

Windows 3.0

3.0

Windows 3.1x

3.1

Windows For Workgroups 3.1

3.1

Windows NT 3.1

NT 3.1

Windows For Workgroups 3.11

3.11

Windows 3.2 (released in Simplified Chinese only)

3.2

Windows NT 3.5

NT 3.5

Windows NT 3.51

NT 3.51

Windows 95

4.0.950

Windows NT 4.0

NT 4.0.1381

Windows 98

4.10.1998

Windows 98 SE

4.10.2222

Windows 2000

NT 5.0.2195

Windows Me

4.90.3000

Windows XP

NT 5.1.2600

Windows XP 64-bit Edition (IA-64)

NT 5.2.3790

Windows Server 2003

NT 5.2.3790

Windows XP Professional x64 Edition

NT 5.2.3790

Windows Fundamentals for Legacy PCs

NT 5.1.2600

Windows Vista

NT 6.0.6002

Windows Home Server

NT 5.2.4500

Windows Server 2008

NT 6.0.6002

Windows 7 and Windows Server 2008 R2

NT 6.1.7600

Windows 8

Unknown

CALL ss64.com for windows scripting help » « Logon failure: the target account name is incorrect