francoiste Posted May 3, 2014 Posted May 3, 2014 (edited) by now there are: window 8 windows 8.1 windows 8.1 + update 1 (april 2014) using the regular macros i'm not able to distinguish between the above: @OSVersion @OSServicePack @OSBuild for the most recent variant 3 i'm just getting: version = WIN_8, servicepack = <empty>, build = 9200. not being able to distinguish between 1 and 2 mainly is because of some crazy decision by microsoft: unless you embed a specific manifest into your application the windows API will "lie" to you. it will report back it was regular windows 8 "initial release".http://msdn.microsoft.com/en-us/library/windows/desktop/dn302074.aspx not being able to detect 3 (update 1) also is because of some doubtful decision by microsoft: "update 1" is different from the "service packs" seen in the past. even though it replaces almost each and every file in the windows OS it's considered just a cumulative "rollup". it does not set any service pack number (i.e. the "CSDBuildNumber").any ideas how to reliably detect the specific version of windows 8.x? right now the only way seems to be manually reading and parsing the REG_SZ "BuildLabEx" below "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersion". on my test system it currently reads: CurrentVersion = 6.3 CurrentBuild = 9600 CurrentBuildNumber = 9600 BuildLab = 9600.winblue_gdr.140305-1710 BuildLabEx = 9600.17041.amd64fre.winblue_gdr.140305-1710 CSDBuildNumber = <does_not_exist> CSDVersion = <does_not_exist> Edited May 3, 2014 by francoiste
UEZ Posted May 3, 2014 Posted May 3, 2014 (edited) You can use WMI to get the information:$objWMI= ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & @ComputerName & "\root\cimv2") $oItems = $objWMI.InstancesOf("Win32_OperatingSystem") For $oTokens In $oItems ConsoleWrite("Operating System: " & $oTokens.Caption & @LF) ConsoleWrite("Version: " & $oTokens.Version & @LF) ConsoleWrite("Build: " & $oTokens.BuildNumber & @LF) Next $bUpdate1 = ((StringRegExpReplace(RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "BuildLabEx"), "\d+\.(\d+)\..*", "$1") = 17041) ? "True": "False") ConsoleWrite("Win8.1 Update 1 installed: " & $bUpdate1 & @CRLF) $CSDBuildNumber = RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CSDBuildNumber") ConsoleWrite("CSDBuildNumber: " & (($CSDBuildNumber = "") ? "n/a" : $CSDBuildNumber) & @CRLF) $CSDVersion = RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CSDVersion") ConsoleWrite("CSDVersion: " & (($CSDVersion = "") ? "n/a" : $CSDVersion) & @CRLF) ConsoleWrite("Winver.exe File Version: " & FileGetVersion("winver.exe") & @CRLF)Br,UEZ Edited May 3, 2014 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
UEZ Posted May 3, 2014 Posted May 3, 2014 (edited) I think there is no "Upate 1" available. You have to check whether KB2919355 has been installed. If yes Win 8.1 Update 1 is installed. Or read the registry, as you already mentioned, for the key BuildLabEx. -> see post#2 Br, UEZ Edited May 3, 2014 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
BrewManNH Posted May 3, 2014 Posted May 3, 2014 What does FileGetVersion return when you use it on Winver.exe in the system32 folder on the various versions of Windows 8? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
francoiste Posted May 12, 2014 Author Posted May 12, 2014 sorry, i was lagging behind. after upgrading from AutoIt 3.3.8.1 to 3.3.10.2 i noticed the following: per default the microsoft manifest is being added to the compiled script: >17:47:39 Performing the Program Resource Update steps: ...>Updating Program Version information. ...>Setting Program ExecutionLevel Manifest information to asInvoker ...>Setting Program Compatibility Manifest information to Windows8.1 ...>Updating Program Manifest information. >17:47:40 Program Resource updating finished successfully. because of this the regular macro "@OSVersion" is able to distinguish between "WIN_8" and "WIN_81" just fine. the only remaining problem is detect "update 1" - where currently the only solution seems to be manually reading and parsing the registry for "BuildLabEx".
francoiste Posted April 23, 2015 Author Posted April 23, 2015 (edited) for reference:some "related" thread has been started here: https://www.autoitscript.com/forum/topic/166932-os-version/ Edited June 16, 2015 by francoiste
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now