Talk:Get Windows version

From NSIS Wiki

- I Get "8.1" on Windows 10 by using this script, searched the internet, I think the script should check "CurrentMajorVersionNumber" and "CurentMinorVersionNumber" value on Windows 10


Guys. Not sure if you will like this but I kept having problems with Windows 10 appearing as 8.1. I modified one of the sections to check for a Windows 10 Cortana file and then forcibly set 6.4 as the value. Comments or better suggestions - please?

Before:

StrCmp $R1 '5.0' lbl_winnt_2000
 StrCmp $R1 '5.1' lbl_winnt_XP
 StrCmp $R1 '5.2' lbl_winnt_2003
 StrCmp $R1 '6.0' lbl_winnt_vista_2008
 StrCmp $R1 '6.1' lbl_winnt_7_2008R2
 StrCmp $R1 '6.2' lbl_winnt_8_2012
 StrCmp $R1 '6.3' lbl_winnt_81_2012R2
 StrCmp $R1 '6.4' lbl_winnt_10_2016 ; the early Windows 10 tech previews used version 6.4

After:

StrCmp $R1 '5.0' lbl_winnt_2000
 StrCmp $R1 '5.1' lbl_winnt_XP
 StrCmp $R1 '5.2' lbl_winnt_2003
 StrCmp $R1 '6.0' lbl_winnt_vista_2008
 StrCmp $R1 '6.1' lbl_winnt_7_2008R2
 StrCmp $R1 '6.2' lbl_winnt_8_2012
  #LPenguin's Windows 10 test (before Windows 8.1)---
 IfFileExists C:\Windows\ImmersiveControlPanel\Settings\CortanaSettings.settingcontent-ms +2 0    
 StrCmp $R1 '6.3' lbl_winnt_81_2012R2
 StrCpy $R1 '6.4'
 StrCmp $R1 '6.4' lbl_winnt_10_2016 ; the early Windows 10 tech previews used version 6.4
Personal tools
donate