Skip to content
⌘ NSIS Forum Archive

Unable to read windows version for vista

7 posts

gugaliashashank#

Unable to read windows version for vista

Hi All,

I am reading the following registry entry

"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion

using the following command in Vista OS to chekc whether its Vista or not.

ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion

but $R0 always return 5.1, which means XP

I checked currentVersion in the registry its 6.0 only not 5.1

I have test this in Vista Ultimate as wwell as Vista Home
I am using NSIS 2.39


One more problem which i faced in Vista is even if i set SetShellVarContext current, the createshortcut are creating shortcuts for all user instead of current user.
gugaliashashank#
I used "RequestExecutionLevel admin" but still i am getting the version as 5.1

I agree that now i am not facing the second problem that is createshortcut
gugaliashashank#
Just to add that i also used
Winver.nsh
${if} ${IsWinXp}
${if} ${IsWinVista}

it returns true for Xp in Vista OS
gugaliashashank#
I tried using register.dll also , still it did not works

I tried to read
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "ProductName"

but instead of returing windows vista (TM) Home Basics
it returns Microsoft Windows XP
pbingel#
Not sure if this will help or not.


nsExec::ExecToStack '"$SYSDIR\cmd.exe" /c systeminfo |find "OS Name:"'
Pop $0
Pop $1
MessageBox MB_OK "$1"
I don't have Vista so wasn't able to test it, but it works on XP. I used systeminfo to recover similar info with help from LoRd_MuldeR for the syntax. You will probally want to use StrCpy to truncate the string also note there is a carriage return on the end of the string.

Edit: If you want the OS version subsitute "OS Version:" in place of "OS Name:"