Bom dia
A função aberta no Win 11 continua a informar que é o Win 10
Public Function MostraVersao()
Dim shell, strOS, strVerKey, strVersion
Set shell = CreateObject("WScript.Shell")
strOS = shell.ExpandEnvironmentStrings("%OS%")
If strOS = "Windows_NT" Then
strVerKey = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
strVersion = shell.RegRead(strVerKey & "ProductName") ' & " " & shell.regread(strVerKey & "CurrentVersion") & "." & shell.regread(strVerKey & "CurrentBuildNumber")
Else
strVerKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\"
strVersion = shell.RegRead(strVerKey & "ProductName") '& " " & shell.regread(strVerKey & "VersionNumber")
End If
MostraVersao = strVersion
Set shell = Nothing
End Function
A função aberta no Win 11 continua a informar que é o Win 10
Public Function MostraVersao()
Dim shell, strOS, strVerKey, strVersion
Set shell = CreateObject("WScript.Shell")
strOS = shell.ExpandEnvironmentStrings("%OS%")
If strOS = "Windows_NT" Then
strVerKey = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
strVersion = shell.RegRead(strVerKey & "ProductName") ' & " " & shell.regread(strVerKey & "CurrentVersion") & "." & shell.regread(strVerKey & "CurrentBuildNumber")
Else
strVerKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\"
strVersion = shell.RegRead(strVerKey & "ProductName") '& " " & shell.regread(strVerKey & "VersionNumber")
End If
MostraVersao = strVersion
Set shell = Nothing
End Function
Última edição por Assis em 15/2/2023, 07:27, editado 1 vez(es)