Archive: GetParameters and /D=


GetParameters and /D=
Hello,

I need to know whether the user chose a custom directory using the command line parameter.
I wanted to use GetParameters, only to know it doesn't return the /D= parameter.
Any alternatives?


I'll hazard a guess:

Function .onInit
${If} $INSTDIR != "YourDefaultDirectory"
MessageBox MB_OK "Custom folder."
${EndIf}
FunctionEnd


What Msg suggests will probably work 99% of the time (The last percent is for short names and junctions etc)

...but why do you care?


Originally posted by stopasking
I wanted to use GetParameters, only to know it doesn't return the /D= parameter.
GetOptions is used for that

@MSG: That's what I did, looks a bit dirty though.


Instead you can just omit InstallDir and therefore $INSTDIR will be empty in .onInit unless /D= was passed (with a value). If $INSTDIR is empty, just set a $INSTDIR value with StrCpy.

@Yathosho: /D= isn't included in $CMDLINE (manual states this).

Stu