Thanks, I think that would work. CurrentMajorVersionNumber or CurrentMinorVersionNumber does not exist in the Windows 7 registery. I dont know how this is in Windows 8.1. ReadRegistryKey will give an error if the entry does not exist, thats why I used ExitOnError(False) in the example below.plouf wrote: ↑Sun Jan 17, 2021 5:23 pm using google search, found the following conversation
https://stackoverflow.com/questions/310 ... m-registry
explains why if you get "6.3" you should double check using the new variables
CurrentMajorVersionNumber and
CurrentMinorVersionNumber
if it works for you, please post result for future help, since i have not handy win10 atm to check
Code: Select all
SetFont(#SANS, 36)
SetFontStyle(#ANTIALIAS)
ExitOnError(False)
winver$ = ReadRegistryKey(#HKEY_LOCAL_MACHINE,"Software/Microsoft/Windows NT/CurrentVersion/CurrentVersion")
winver = Val(winver$)
If winver < 6.1
TextOut(#CENTER, #CENTER, "Your Windows version is older than Windows 7")
ElseIf winver = 6.1
TextOut(#CENTER, #CENTER, "You are using Windows 7 or 2008 Server")
ElseIf winver = 6.2
TextOut(#CENTER, #CENTER, "You are using Windows 8.0 or 2012 Server")
Else
winmajor$ = ReadRegistryKey(#HKEY_LOCAL_MACHINE,"Software/Microsoft/Windows NT/CurrentVersion/CurrentMajorVersionNumber")
winmajor = Val(winmajor$)
If winmajor < 10
TextOut(#CENTER, #CENTER, "You are using Windows 8.1 Or 2012 Server")
Else
TextOut(#CENTER, #CENTER, "You are using Windows 10 or newer")
EndIf
EndIf
WaitLeftMouse
End
If using Val(ReadRegisteryKey(xxx) on a key that doesnt exist, the script will exit on an error regardless if ExitOnError is set to false.
Thats why I read the registerykey into a string first and then convert it into value in a separate line in the script above.