WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Win8

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

WinVersion Issue With Windows 8_1

 Keywords: WinVersion Issue  Windows 8.1 6.2 6.3 6-2 6-3  GetVersion GetVersionEx VerifyVersionInfo Registry WMI .NEt dotNEt

Okay here is a quick explanation as to why the WinVersion function is returning 6.2 (Windows 8.0) rather than 6.3 (Windows 8.1) on Windows 8.1 systems. The underlying GetVersion(Ex) API has been deprecated on Windows 8.1. Microsoft says that is to prevent compatibility problems. Personally, I think it is a horrible idea to break the API in that way.

Possible workarounds:

Here is a code sample for the WMI and Registry workarounds:
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" 
   ; WMI workaround
   ;objWMIService = GetObject("winmgmts:\\.\root\cimv2")
   ;colItems= objWMIService.ExecQuery("Select Version from Win32_OperatingSystem")
   ;ForEach objItem In colItems
   ;      If ObjectTypeGet(objItem)=="EMPTY" Then Continue
   ;      v = objItem.Version
   ;      break
   ;Next
   ;v = StrReplace(StrSub( v, 1, 3 ),'-','.')

        ;Registry workaround
        v = RegQueryValue(@REGMACHINE,"Software\Microsoft\Windows NT\CurrentVersion[CurrentVersion]",64)

   if v == '6.2' then Platform="Windows 8.0 / 2012"
   if v == '6.3' then Platform="Windows 8.1"
endif
Message("Platform",Platform)
Exit
With the exception of the WinVersion function WinBatch 2013C has no known compatibility issue with Windows 8.1 and Windows 2012 R2.

It is interesting to note that even the lastest version of MSFT's dotNet framework's OperatingSystem class reports the same 6.2 version for both Windows 8 and 8.1. So WinBatch is not alone. MSFT has decided that checking the OS version is evil for some very dubious reasons.

As demonstrated there are several other ways to obtain the OS version.


Article ID:   W18447
Filename:   WinVersion Issue With Windows 8_1.txt
File Created: 2013:11:14:12:23:36
Last Updated: 2013:11:14:12:23:36