Skip to content
⌘ NSIS Forum Archive

Windows version from registry

8 posts

Joel#

Windows version from registry

ok, one question about the registry:

I wanna read this string from Nsis:


ReadRegStr $R6 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" "ProductName"
It suppose to read the name of the Windows installed... It works in
my machine Windows ME, because display in the output:
"Microsoft Windows ME".

My question is: does Win95/98 has the same reg path? and What about
NT/2000/XP?

Thanks 😛
kichik#
Use GetWindowsVersion to get the name of the OS:
Joel#
already try that 😉
but with this you can simplifly the function with 2 or 3 line code.
what you think?
kichik#
On NT you'll have to use:

ReadRegStr $R6 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "ProductName"
GetWindowsVersion already does that for you, and it was tested on those versions of Windows. You'll have to make sure ProductName is on every Windows version.
Afrow UK#
ReadRegStr $R6 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" "ProductName"

Doesn't work on WinXP

-Stuart
Joel#
Originally posted by Afrow UK
ReadRegStr $R6 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" "ProductName"

Doesn't work on WinXP

-Stuart
That's way:


ReadRegStr $R6 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "ProductName"
ReadRegStr $R6 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" "ProductName"
;Only one it's going to have the name of Windows in $R6