isawen
19th January 2011 12:20 UTC
Setup with a single command line argument
Hi again,
Probably this is how the actual ${GetOption} command works, but I wanted to be sure.
Let's assume my installer parses the command line arguments passed when executed and it searches for this flag option "/argument1".
ClearErrors
${GetOptions} $cmdLineParams '/argument1' $R0
IfErrors +2 0
If I execute the installer and pass the /argument1234 it detects that /argument1 was passed. Is there a way to avoid this situation?
Thanks,
Isa
Yathosho
19th January 2011 12:30 UTC
use GetParameters
isawen
19th January 2011 12:34 UTC
I'm not sure what do you mean by ${GetParameter}.
I'm using it to get the command line arguments into my $cmdLineParams variable.
820815
19th January 2011 15:24 UTC
use the /argument=1 then StrCmp $R0 1
isawen
19th January 2011 15:30 UTC
That could be a solution but it's more fashion way to have a simple flag (without any value). If this is not possible then I will consider using this.
Thanks,
Isa
isawen
19th January 2011 15:33 UTC
Originally posted by 820815
use the /argument=1 then StrCmp $R0 1
My flag name is argument1, but that doesn't mean I'm parsing the last 1 from the argument.
Maybe I have choosed a bad name for the argument.
My point is that if you want to have just a flag to be passed as the argument, when you pass as argument a string that begins with your flag the NSIS will consider the flag present it's like the argument you are passing is somehow truncated.
Afrow UK
19th January 2011 15:47 UTC
If you want to match /argument1 exactly then you'll have to also check $R0 is an empty string.
Stu
isawen
19th January 2011 16:12 UTC
Originally posted by Afrow UK
If you want to match /argument1 exactly then you'll have to also check $R0 is an empty string.
Indeed, how come this didn't cross my tired mind.
Again thanks for your help.