Check for Windows 7 / Seven
Hi,
is there any way to check if user is running Windows 7 ?
Thanks
and greets
kando
Archive: Check for Windows 7 / Seven
Check for Windows 7 / Seven
Hi,
is there any way to check if user is running Windows 7 ?
Thanks
and greets
kando
WinVer.nsh will give you the version number, so check for >=6.1
How to do that with WinVer.nsh ?
It offers me only the following functions
and not getting the version number to compare it ?
; AtLeastWin<version> checks if the installer is running on Windows version at least as specified.
; IsWin<version> checks if the installer is running on Windows version exactly as specified.
; AtMostWin<version> checks if the installer is running on Windows version at most as specified.
;
; <version> can be replaced with the following values:
;
; 95
; 98
; ME
;
; NT4
; 2000
; XP
; 2003
; Vista
; 2008
It's slightly hidden away / not documented. Near the bottom of WinVer.nsh are the bits you'll want to peek at. Example:
${WinVerGetMajor} $0
${WinVerGetMinor} $1
${WinVerGetBuild} $2
${WinVerGetServicePackLevel} $3
MessageBox MB_OK "$0.$1.$2 SP$3"
Windows 7 has settled on 6.1? If so, we should add it to WinVer.nsh.
The Release Candidate, Build 7100, is version 6.1, yes.
For confirmation.. download and install, or poke at a number of websites who have done so and peruse screenshots of the 'about screen' :)
There was some talk of that 6.1 not being the case if they ever got around to implementing minwin but.. yeah
minwin was never a product, closest you get is server core
We don't know the build number until RTM, but using 6.1.0000 for now would probably work
Originally posted by AnimaetherHere is a screenshot. it is 6.1 for now.
The Release Candidate, Build 7100, is version 6.1, yes.
For confirmation.. download and install, or poke at a number of websites who have done so and peruse screenshots of the 'about screen' :)
Originally posted by PepeSoftAnd it will be 6.1 later in W7. See here:
Here is a screenshot. it is 6.1 for now.
[Image]
-Pawel
That MSDN page also says Windows 2008 R2 has the same version number. Need to work around that one like we worked around Vista and 2008. Anders, care to handle this?
for those that can't wait for the next release, get it from http://nsis.svn.sourceforge.net/view...ude/WinVer.nsh
Also, if anyone has Windows 7 and/or Windows Server 2008 R2, please add it to the WinVer test thread.
Originally posted by kichikKichik,
Also, if anyone has Windows 7 and/or Windows Server 2008 R2, please add it to the WinVer test thread.
The tool from the thread is version independent. The version attached there should work fine on Windows 7 as well.
I can't seem to get Windows 7 to even show up with I pop the variable. I am using the latest WinVer.nsh that includes Win7 routines.
Any help is greatly appreciated.
Please see my code.
Function .onInit
GetVersion::WindowsName
Pop $R0
;${If} $R1 == "64"
; Goto no64
;${EndIf}
${If} $R0 == "XP"
Goto xp
${ElseIf} $R0 == "XP x64"
Goto go_away
${ElseIf} $R0 == "2000"
Goto go_away
${ElseIf} $R0 == "Server 2003"
Goto go_away
${Elseif} $R0 == "Server 2003 R2"
Goto go_away
${Elseif} $R0 == "Vista"
Goto vista
${Else}
Goto error
${EndIf}
; i suppose i do need to add a win7 block? will there be multiple SKUs like Vista?
xp:
GetVersion::WindowsType
Pop $R0
${If} $R0 == "Professional"
${OrIf} $R0 == "Tablet PC Edition"
Goto go_away
${Else}
Goto non_professional
${EndIf}
non_professional:
MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_TOPMOST|MB_DEFBUTTON2 \
"The XYZ-Soft software has not been tested on, and is not supported on Windows XP $R1.$\r$\n$\r$\nXYZ-Tek cannot \
provide technical support for this installation.$\r$\n$\r$\nDo you want to continue?" \
IDYES go_away IDNO done
vista:
GetVersion::WindowsType
Pop $R1
${If} $R1 == "Home Basic Edition"
MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_TOPMOST|MB_DEFBUTTON2 \
"The XYZ-Soft software has not been tested on, and is not supported on Windows $R0 $R1.$\r$\n$\r$\nXYZ-Tek cannot \
provide technical support for this installation.$\r$\n$\r$\nDo you want to continue?" \
IDYES go_away IDNO done
${ElseIf} $R1 == "Home Premium Edition"
MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_TOPMOST|MB_DEFBUTTON2 \
"The XYZ-Soft software has not been tested on, and is not supported on Windows $R0 $R1.$\r$\n$\r$\nXYZ-Tek cannot \
provide technical support for this installation.$\r$\n$\r$\nDo you want to continue?" \
IDYES go_away IDNO done
${ElseIf} $R1 == "Starter Edition"
MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_TOPMOST|MB_DEFBUTTON2 \
"The XYZ-Soft software has not been tested on, and is not supported on Windows $R0 $R1.$\r$\n$\r$\nXYZ-Tek cannot \
provide technical support for this installation.$\r$\n$\r$\nDo you want to continue?" \
IDYES go_away IDNO done
${Else}
Goto go_away
${EndIf}
error:
; generic block for the rest of OS's... 95,98,Me,7, etc. ???
MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_TOPMOST|MB_DEFBUTTON2 \
"The XYZ-Soft software has not been tested on, and is not supported on Windows $R0 $R1.$\r$\n$\r$\nXYZ-Tek cannot \
provide technical support for this installation.$\r$\n$\r$\nDo you want to continue?" \
IDYES go_away IDNO done
done:
Quit
You are using GetVersion plug-in and not WinVer.nsh. Use:
!include WinVer.nsh
${If} ${IsWin7}
MessageBox MB_OK 7
${ElseIf} ${IsWin2000}
MessageBox MB_OK 2000
# etc... ${ElseIf}...
${EndIf}
oops,
thanks! (i think i used winver at one point in my life but switched i guess, i think my old codebase has it).
Okay.. I got a couple of more questions.
In GetVersion they have the ability to find home edition detection (probably why i used it to begin with), is WinVer.nsh going to detect the different SKUs of Home/Vista/7 (Home/Pro/Home Basic/Ultimate/...) Is there a way to detect that?
Also, I like to detect anything below Win 95 (Windows 1.0 - 3.11). is there a way to detect < 95? (I know GetVersion does for example)
Since I know GetVersion more, is my logic below correct? How do I get the version to display in the second message?
Function .onInit
; Give warning about Windows 7
${If} ${IsWin7}
MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_TOPMOST|MB_DEFBUTTON2 \
"The blah software has not been tested on, and is not supported on Windows 7.$\r$\n$\r$\nFoobar Industries cannot \
provide technical support for this installation.$\r$\n$\r$\nDo you still want to continue with the installation?" \
IDYES go_away IDNO done
${ElseIf} ${AtLeastWin95}
${And} ${AtMostWinME}
MessageBox MB_OK|MB_ICONSTOP "Windows -version- is not supported by the blah software." IDOK ; Anything below 2000 throw error
Quit
; what about below 95 (Win 1 - 3.11)
${EndIf}
done:
Quit
go_away:
; ...
lol, Win v1.
AFAIK, NSIS does not work on anything below v4
I thought nsis did work with < 4.
I thought it can with 3.1 at least, though i never verified it. i thought i saw it in some forum.
Win 3.1 is 16bit, you would have to install Win32s on there
Okay but how do I determine the windows version using winver in the output?
${ElseIf} ${AtLeastWin95}
${And} ${AtMostWinME}
MessageBox MB_OK|MB_ICONSTOP "Windows -version- is not supported by the blah software." IDOK ; Anything below 2000 throw error
Quit
${EndIf}
My above code doeswnt seem to work. I tried changing And to AndIf and made no difference other than it allowed me to compile it.
I am unable to execute the installer.
it would be lovely, if WinVer could make a check if the user is running a 64-bit system (whether its xp, vista or win7 etc.). something like ${Is64bit}/${Is32bit} would be very helpful!
Originally posted by Yathoshox64.nsh
it would be lovely, if WinVer could make a check if the user is running a 64-bit system (whether its xp, vista or win7 etc.). something like ${Is64bit}/${Is32bit} would be very helpful!
hi
for win 8 & xp
Is this true?
${If} ${IsWin8}
MessageBox MB_OK 8
${ElseIf} ${IsXP}
MessageBox MB_OK XP
# etc... ${ElseIf}...
${EndIf}
???????
[QUOTE]
var isWindowsXP
var IsWindows7
var IsWindows8
------
Version::IsWindowsXP
Pop $isWindowsXP
${If} $isWindowsXP == "1"
Goto XP
${EndIf}
Version::IsWindows7
Pop $IsWindows7
${If} IsWindows7 == "1"
Goto WINDOWS7
${EndIf}
Version::IsWindows8
Pop $IsWindows8
${If} IsWindows8 == "1"
Goto WINDOWS8
${ElseIf}
MessageBox MB_OK|MB_ICONSTOP|MB_TOPMOST "$(OS_NOT_S)"
QUIT
${EndIf}
WINDOWS8:
WINDOWS7:
xp: