Archive: GetVersion::WindowsName causing 'invalid command' error


GetVersion::WindowsName causing 'invalid command' error
Please help, feeling really stuck!

I was using NSIS version 2.37 and upgraded to 2.42, now my previously OK code won't compile! I've tried going back to 2.37 (including un-installing) and it still causes an 'invalid command' error.

I'm trying to check for certain operating systems, otherwise display a message and stop the install.

So code was like this:

Function CheckOperatingSystem
GetVersion::WindowsName
Pop $R0
StrCpy $R0 '2000'
${If} $R0 == '2000'
${OrIf} $R0 == 'Server 2003'
${OrIf} $R0 == 'Server 2003 R2'
${OrIf} $R0 == 'Vista'
;Any of these operating systems can have a service running
${Else}
MessageBox MB_ICONSTOP "Sorry, you need an operating system that can run a service to install the server version of this product"
Abort
${EndIf}
FunctionEnd

Don't think I had included the WinVer plug-in (but I have now, just in case!)

Please could someone help me and tell me how to get this working again, or guide me on using 'IsWin2000' etc, if it's possible to do it that way?

THANKS VERY MUCH.

Fran.


it would help if you included the compiler error message... (Invalid command, if thats the message, I would guess its a missing plugin)

Your code does not make sense, when you do StrCpy $R0 '2000', it will always come out as 2000

anyways, why not just use WinVer.nsh and just check if running on NT (all versions of NT supports services)


As Anders said - use WinVer.nsh

You mention that you "including the WinVer plug-in" - but WinVer.nsh is a script header file, completely unrelated to your 'GetVersion::WindowsName' code - which is a call to the GetVersion plugin ( http://nsis.sourceforge.net/GetVersion_(Windows)_plug-in ).


Thank you Anders & Animaether for replying.

The compiler error was:
Function: "CheckOperatingSystem"
Invalid command: GetVersion::WindowsName
Error in script "C:\NSIS Installer projects\MyProduct.nsi" on line 637 -- aborting creation process

Yeah, I was getting confused between the WinVer script header file and the GetVersion plugin.
Since changing NSIS versions, I no longer had the GetVersion.dll in my Plugins folder, now sorted.

Thank you,
Fran.