>I am using the command OS(1) to return which version of windows is currently running on a system. It returns "Windows 5.01" (this i guess means WinXP cause thats what I am using). I need to determine what the different values that get returned mean for example is windows 4.01 = WINDOWS ME ? is windows 2.01 = Windows 98 ? Help!?!?
>Also on a simular subject how do you know which Windows Service pack is installed?
Another way you can do it is Using WMI, if you have any of this OSs:
Client: Included in Windows XP, Windows 2000 Professional, Windows NT Workstation 4.0 SP4 and later.
Server: Included in Windows Server 2003, Windows 2000 Server, Windows NT Server 4.0 SP4 and later.
? getOSVersion()
function getOSVersion()
local loWMIService, loWBEMLocator, loOSs, loOS, lcOSVersion
lcOSVersion = 'Unknown'
try
loWBEMLocator = createObject("wbemScripting.SwbemLocator")
loWMIService = loWBEMLocator.ConnectServer()
catch
loWMIService = null
endtry
if not Isnull(loWMIService)
loOSs = loWMIService.ExecQuery('Select Caption, Version, ServicePackMajorVersion, ServicePackMinorVersion from Win32_OperatingSystem')
for each loOS in loOSs
with loOS
lcOSVersion = .Caption + " " + .Version + " SP " + Transform(.ServicePackMajorVersion) + '.' + Transform(.ServicePackMinorVersion)
endwith
exit
endfor
endif
return lcOSVersion
You can add/or remove information from the final string, or change the format or whatever
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?
"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare
"To die for a religion is easier than to live it absolutely"
Jorge L. Borges