Old 22nd January 2009, 16:00   #1
fran_elvin
Junior Member
 
Join Date: Jan 2009
Location: Nottingham, UK
Posts: 2
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.
fran_elvin is offline   Reply With Quote
Old 22nd January 2009, 20:31   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
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)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 22nd January 2009, 21:04   #3
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
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 ).
Animaether is offline   Reply With Quote
Old 27th January 2009, 09:29   #4
fran_elvin
Junior Member
 
Join Date: Jan 2009
Location: Nottingham, UK
Posts: 2
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.
fran_elvin is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump