OsVersion$

System function.

The OsVersion$ function returns the Windows version.

Syntax

var$=OsVersion$()

Return value

var$, string, Windows version.

Example

 

OsVersion$()

Example code

This script shows a function which returns a string containing OS version.

 

'Function donne_Os$ returns a string containing OS version :

'95 Windows 95

'98 Windows 96

'Me Windows Millenium Edition

'nt Windows NT

'2000 Windows 2000

'XP Windows XP

'2003 Windows 2003 Server
'Vista
'Windows 7

function donne_Os$()

local os$

 

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

 

Select Case os$

Case "4.10"

os$="98"

 

Case "4.00"
'to know if it's 95 or nt, you must read the OS environment variable

osvar$=envir$("OS")

if osvar$="Windows_NT" then

os$="nt"

else

os$="95"

endif

 

Case "4.90"

os$="Me"

Case "5.00"

os$="2000"

Case "5.01"

os$="XP"

Case "5.02"

os$="2003"

Case "6.00"

os$="Vista"

Case "7.00"

os$="Windows 7"

Case Else

os$="Unknown Version"

EndSelect

 

donne_os$=os$

 

endfunction

'---------------------------------------------------

 

a$=donne_os$()

msgbox("Windows "+a$)