Home > Language Reference > System Functions > OsVersion$

OsVersion$

The OsVersion$ function returns the operating system version information.

Usage

Used to process different actions depending on your Windows version.

Syntax

var$ = OsVersion$()

Parameters

None.

Return value

var$, string, Windows version. The possible values are:
 Operating system  Return value
 Windows 7  6.1
 Windows Server 2008 R2  6.1
 Windows Server 2008  6.0
 Windows Vista  6.0
 Windows Server 2003  5.2
 Windows XP  5.1

 

Example

'Function donne_Os$ returns a string containing OS version:
'XP for Windows XP
'2003 for Windows 2003 Server
'Vista
'Windows 7

function donne_Os$()
local os$

os$=left$(OsVersion$(),4)

Select Case os$
Case "5.01"
os$="XP"
Case "5.02"
os$="2003"
Case "6.00"
os$="Vista"
Case "6.01"
os$="Windows 7"
Case Else
os$="Unknown Version"
EndSelect

donne_os$=os$

endfunction
'---------------------------------------------------

a$=donne_os$()
msgbox("Windows version is: "+a$)