OsVersion$ – System Function





OsVersion$ Function


Syntax

var$ = OsVersion$()

Return value

var$: String containing the Windows version.

Example

OsVersion$()

Example code

' This script demonstrates a function that returns a string containing the OS version.
' Windows versions are identified and returned in readable format.
function donne_Os$()
    local os$
    os$ = left$(OsVersion$(), 4)
    
    Select Case os$
        Case "4.10"
            os$ = "98"
        Case "4.00"
            ' To distinguish between Windows 95 and Windows NT, check 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 Else
            os$ = "Unknown Version"
    EndSelect
    
    donne_Os$ = os$
endfunction

' ---------------------------------------------------
a$ = donne_Os$()
msgbox("Windows " + a$)