WinVersion

Provides the version number of the current Windows system.

Syntax:

WinVersion (level)

Parameters:

(i) level see below.

Returns:

(i) Windows version number.

 

Level

Returns

0

(i) Minor version: returns the decimal part of the Windows version number; i.e. 1.0, 2.11, 3.0, etc.

1

(i) Major version: returns the integer part of the Windows version number; i.e. 1.0, 2.11, 3.0, etc.

2

(i) Build number

3

(s) CSD version: returns a string indicating the latest service pack that has been installed (e.g., "Service Pack 1"), or a blank string ("") if no service pack has been installed.

4

(i) Windows platform

This is exactly the same as WinMetrics(-4), i.e.:

Value

Meaning

0

Other

1

Windows 3.X

2

Windows for Workgroups

3

Win32s

4

Windows NT Family

5

Windows 95/98/ME

 

5

 

(s) Version string

This is a string in the form:

"platform-major-minor"

where "platform" is one of the following:

Value

Meaning

0

Win32s

1

Windows 95/98/ME

2

Windows NT Family

 

6

Major version number of the latest Service Pack installed.

7

Minor version number of the latest Service Pack installed.

8

Bit flags that identify the product suites available on the system. This can be 0, or one or more of the following values, combined using the bitwise OR ('|') operator:

Value

Meaning

1

Microsoft Small Business Server was once installed on the system, but may have been upgraded to another version of Windows (see note below).

2

Windows Server 2008 Enterprise, Windows Server 2003, Enterprise Edition, Windows 2000 Advanced Server, or Windows NT Server 4.0 Enterprise Edition is installed (see note below).

4

Microsoft BackOffice components are installed.

16

Terminal Services is installed.

32

Microsoft Small Business Server is installed with the restrictive client license in force (see note below).

64

Windows XP Embedded is installed.

128

Windows Server 2008 Datacenter, Windows Server 2003, Datacenter Edition or Windows 2000 Datacenter Server is installed.

256

Remote Desktop is supported, but only one interactive session is supported.

512

Windows XP Home Edition is installed.

1024

Windows Server 2003, Web Edition is installed.

8192

Windows Storage Server 2003 R2 or Windows Storage Server 2003is installed.

16384

Windows Server 2003, Compute Cluster Edition is installed.

32768

Windows Home Server is installed.

131072

 AppServer mode is enabled.

Note that you should not solely rely upon the '1' flag to determine whether Small Business Server has been installed on the system, as both this flag and the '32' flag are set when this product suite is installed. If you upgrade this installation to Windows Server, Standard Edition, the '32' flag will be unset, however, the '1' flag will remain set. In this case, this indicates that Small Business Server was once installed on this system. If this installation is further upgraded to Windows Server, Enterprise Edition, the '1' flag will remain set.

9

Additional information about the system. This can be one of the following values:

Value

Meaning

1

The operating system is Windows "Longhorn", Windows XP Professional, Windows XP Home Edition, Windows 2000 Professional, or Windows NT Workstation 4.0.

2

The system is a domain controller.

3

The system is a server.

 

11

Windows 10 ReleaseID which is the four digit version number associated with Windows 10 semiannual feature updates. Empty string on other versions of Windows.

(ReleaseID is deprecated on Windows 11 and always returns "2009").

12

Windows 10/11 DisplayVersion  which is the four character version string  associated with Windows 10/11 feature updates. Empty string on other versions of Windows.

Notes: A server that is also a domain controller is reported as '2', not '3'.

A blank string will be returned for levels 6 - 9 on unsupported Windows platforms.

To decipher between all Windows platforms. Use the function WinVersion(5) to tell which one you have:

Windows 

Platform 

Major 

Minor

95

1

4

0

98

1

4

10

ME

1

4

90

NT 3.51

2

3

51

NT 4

2

4

0

NT 2000

2

5

0

XP

2

5

1

2003(server)

2

5

2

Vista / 2008

2

6

0

7 / 2008 R2

2

6

1

8 / 2012

2

6

2

8.1 / 2012 R2

2

6

3

10  / 11 /  2016 /  2019

2

10

0

 

 

v = WinVersion(5)

Platform="Unknown"

if v=="1-4-0" then Platform="Windows 95"

if v=="1-4-10" then Platform="Windows 98"

if v=="1-4-90" then Platform="Windows ME"

if v=="2-3-51" then Platform="Windows NT 3.51"

if v=="2-4-0" then Platform="Windows NT 4.0"

if v=="2-5-0" then Platform="Windows 2000"

if v=="2-5-1" then Platform="Windows XP"

if v=="2-5-2" then Platform="Windows 2003 Server"

if v=="2-6-0" then Platform="Windows Vista / 2008"

if v=="2-6-1" then Platform="Windows 7 / 2008 R2"

if v=="2-6-2" then Platform="Windows 8 / 2012"

if v=="2-6-3" then Platform="Windows 8.1 / 2012 R2"

if v=="2-10-0" then Platform="Windows 10 / 11 / 2016 / 2019"

Message("Platform",platform)

 

Example:

minorver = WinVersion(0)
majorver = WinVersion(1)
buildver = WinVersion(2)
csdver = WinVersion(3)
Message("Windows Version", StrCat(majorver, ".", minorver, " ",buildver, " ", csdver))

See Also:

Environment, FileVerInfo, Version, VersionDLL, WinMetrics