View Single Post
Old 2nd February 2011, 19:40   #7
Junior Member
Join Date: Jan 2011
Posts: 7
Got it working

When I am part of a forum, I try to give back as much as I get from a forum. So, here is a bit more detail on how to get this working, if anyone else is trying to do the same thing. The information that you offered (and that is in the manual) is correct, but there are a few missing pieces that I couldn't find anywhere. I just happened to guess on a few things and got lucky.

To begin with, at the top of your script, you have to include the following or GetParameters and GetOptions won't even compile:

!include "FileFunc.nsh" ; this is critical

Next, the parameters themselves are not put into double quotes. Using the following code

Var roomList

Function .onInit
var /GLOBAL cmdLineParams
Push $R0
${GetParameters} $cmdLineParams
Pop $R0

; Then add the following code goes in the main section
; where the StartMenu shortcut and other commands
; get executed.

${GetOptions} $cmdLineParams "/Params=" $R0
IfErrors +2 0
StrCpy $paramList "$R0"

Then the installer is executed with the following command line.

myInstall.exe /Params=P1,P2,P3

The end result is that $paramList will contain "P1,P2,P3".

Hope this helps others. If anyone wants to comment on other ways to clean up the above code, that will help all of us.
ssamuels_sv is offline   Reply With Quote