zanz
23rd July 2008 20:56 UTC
Best option to detect OS?
I want to limit my installation to:
- Windows NT only AND Windows 2k, Win XP, and Win Vista only. Nor Win Server or Win 98.
I see there's WinVer.nsh that requires some manipulation. Is using WinVer.nsh my best option, is there a developed plug-in (which would work on both XP and Vista)? Thanks!
Afrow UK
23rd July 2008 21:08 UTC
WinVer will detect all of those IIRC.
If not then there's the GetVersion plug-in.
Stu
zanz
23rd July 2008 22:09 UTC
I think I'll give getVersion plug-in a try first...
zanz
23rd July 2008 23:19 UTC
I'm using the plug in, but i get an error when i compile:
Error: could not resolve label "_LogicLib_Label_3" in function "MyOSDetectFunction"
Below is my function...what could be wrong?
Function MyOSDetectFunction
GetVersion::WindowsName
Pop $R0
DetailPrint "WindowsName:"
DetailPrint " $R0"
;check if OS is XP
${If} $R0 == 'XP'
Goto Done
Goto checkVista
${EndIf}
;Check if OS is Vista
checkVista:
${If} $R0 == 'Vista'
Goto Done
Goto checkWin2k
;Check if OS is Win 2000
checkWin2k:
${If} $R0 == '2000'
Goto Done
Goto printMessageAndAbort
printMessageAndAbort:
MessageBox MB_OK|MB_ICONINFORMATION "System not supported."
Abort "Existing installation..."
Done:
FunctionEnd
zanz
23rd July 2008 23:44 UTC
Nevermind, i used the if-else combination and it works fine.
Afrow UK
24th July 2008 10:42 UTC
You can just use WinVer for that.
${Unless} ${IsWinVista}
${AndUnless} ${IsWinXP}
${AndUnless} ${IsWin2000}
MessageBox MB_OK|MB_ICONINFORMATION "System not supported."
Abort
${EndUnless}
I assumed you needed something more.
Stu