Archive: Best option to detect OS?


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!


WinVer will detect all of those IIRC.

If not then there's the GetVersion plug-in.

Stu


I think I'll give getVersion plug-in a try first...


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


Nevermind, i used the if-else combination and it works fine.


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