Jump to content

@OSVersion for Windows 7


bobbintb
 Share

Recommended Posts

I do not have Windows 7 so I can't test this, but here is a little extra past what @OSVersion will give you.

Func _GetOSVersion()
    Local $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    Local $colSettings = $objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
    For $objOperatingSystem In $colSettings
;~         Return $objOperatingSystem.Caption
        Return StringMid($objOperatingSystem.Caption, 19)
    Next
EndFunc   ;==>_getOSVersion
Link to comment
Share on other sites

Or run latest beta -> it is fixed there.

UEZ

Edited 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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Is there a way to find out if I am running Windows 7, short of looking at the OS type and build number? @OSVersion displays it as Vista.

italian = "il mio primo post, spero di aver capito"

Dim $ProductName,$CSDVersion,$BuildLab,$ProductId
$ProductName = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName")
$CSDVersion = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "CSDVersion")
$BuildLab = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "BuildLab")
$ProductId = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductId")
MsgBox(64, "","Informazioni sistema"&@CRLF&"Il tuo sistema operativo è: "&$ProductName&@CRLF&"Il tuo sistema service pack è: "&$CSDVersion&@CRLF&"Il tuo numero di laboratorio è: "&$BuildLab&@CRLF&"Il tuo id del prodotto è: "&$ProductId )
Link to comment
Share on other sites

I run testing on various OS's including Windows 7, and until the next release when the macro should be updated to include Windows 7, I put in a check of the registry to include what build number is running.

This is the function I use to return What OS, service pack and if we are running an 64 bit OS.

_OSVersion()
Func _OSVersion()
    Local $OS_Version, $servicepack_version
    $OS_Version = StringStripWS(StringRegExpReplace(@OSVersion, "(WIN_)|(Microsoft )|(Windows )|(\(TM\))|( Ultimate)", ""), 8)
    $OS_Version = StringRegExpReplace(StringRegExpReplace($OS_Version, '2008', 'Win7'), 'VISTA', 'Vista')
    If RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", 'CurrentBuildNumber') > 7000 Then $OS_Version = 'Win7'
    $servicepack_version = StringReplace(@OSServicePack, "Service Pack ", "SP")
    If @error = -1 Then $servicepack_version = ""

    ConsoleWrite($OS_Version & $servicepack_version & StringRegExpReplace(@OSArch, '(X86)', '') & @CRLF)
    Return $OS_Version & $servicepack_version & StringRegExpReplace(@OSArch, '(X86)', '')
EndFunc   ;==>_OSVersion

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...