Menu

#299 nonstandatd behavior of example for command line parameters

2.0 Series
closed-fixed
5
2006-04-05
2004-12-02
Anonymous
No

In chapter "4.12 Silent Installers/Uninstallers" is
example how to read and parse command line parameters.
It expect that quotes will be in form:
"/USERNAME=guest". I think that correct quotes using is
/USERNAME="guest". Here is my macro for such parsing:
!macro FindParam params paramName
${StrStr} $0 "${params}" "/${paramName}="
StrCmp $0 "" no${paramName}
Push $1
Push $2
StrLen $1 "/${paramName}="
StrCpy $0 $0 "" $1
StrCpy $1 $0 1
StrCpy $2 " "
StrCmp $1 '"' 0 notquo${paramName}
StrCpy $2 '"'
StrCpy $0 $0 "" 1
notquo${paramName}:
${StrStr} $1 $0 $2
StrLen $2 $0
StrLen $1 $1
IntOp $2 $2 - $1
StrCpy $0 $0 $2
Pop $2
Pop $1
no${paramName}:
!macroend

Example of use:
Call GetParameters
Pop $9
!insertmacro FindParam $9 "USERNAME"
IfFileExists "$0" 0 skipUSERNAME

Discussion

  • Amir Szekely

    Amir Szekely - 2004-12-02
    • assigned_to: zarg --> kichik
     
  • Amir Szekely

    Amir Szekely - 2004-12-02

    Logged In: YES
    user_id=584402

    If already updating, why not make it recognize both?

     
  • Amir Szekely

    Amir Szekely - 2006-04-05
    • status: open --> closed-fixed
     
  • Amir Szekely

    Amir Szekely - 2006-04-05

    Logged In: YES
    user_id=584402

    Added a link to GetOptions which operates the standard way.

     

Log in to post a comment.