|
|
#1 |
|
Junior Member
Join Date: Dec 2009
Posts: 2
|
Reading command line parameter at runtime
Hello,
I'm trying to use NSIS to do 2 functions with a single installer. 1) Install my program, and stop 2) Update my program, and launch it with a parameter. I was hoping to do something like that : setup.exe, without arguments, will install my program and stop setup.exe parameter, will update (reinstall) my program and launch "program.exe parameter" at the end of the installation. I don't know how to check a condition in order to launch / don't launch my program, and I don't know how to read a parameter and launch a program with this parameter as argument. How NSIS can do this ? Thanks for your help |
|
|
|
|
|
#2 |
|
Major Dude
Join Date: Oct 2006
Posts: 1,892
|
Re: Reading command line parameter at runtime
Why don't you try searching the forums for 'command line parameters'?
|
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Aug 2007
Location: Paris, France
Posts: 304
|
and search NSIS documentation for 'command line parameters'
My NSIS plug-ins: http://wiz0u.free.fr/prog/nsis.php |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Dec 2009
Posts: 2
|
Sorry, I didn't understand how GetParameters / GetOptions worked.
Now, I can see how to detect if it's an update or an install, but how can I pass the parameter value to the program ? Actually, I'm launching a program with the following lines : ; Finish page !define MUI_FINISHPAGE_RUN "$INSTDIR\MyApp.exe" !define MUI_FINISHPAGE_RUN_PARAMETERS "test" !insertmacro MUI_PAGE_FINISH I don't know how to use a variable as parameter. |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Aug 2007
Location: Paris, France
Posts: 304
|
Var myvar
!define MUI_FINISHPAGE_RUN_PARAMETERS "$myvar" StrCpy myvar "value" My NSIS plug-ins: http://wiz0u.free.fr/prog/nsis.php |
|
|
|
|
|
#6 |
|
Member
Join Date: Oct 2009
Posts: 72
|
Hi Wizou,
I am also having trouble using variable at runtime. Seem like it has to be a static variable in order for it to work. Below is what I am trying to do, but $Country have to be pre-defined. Is there anyway it can be variable like how I want it? Thanks! === Var Country ; License page !define MUI_LICENSEPAGE_CHECKBOX !insertmacro MUI_PAGE_LICENSE "..\doc\${Country}\license.rtf" Function CountrySelectionLeave ${NSD_LB_GetSelection} $ListBox $0 StrCpy $Country $0 FunctionEnd |
|
|
|
|
|
#7 | |
|
Major Dude
Join Date: Oct 2006
Posts: 1,892
|
Quote:
|
|
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Aug 2007
Location: Paris, France
Posts: 304
|
@jdt2oo7: You can't select the license text file at runtime (except through multilanguage) because NSIS has to know about those files at compile-time in order to compress them inside the installer.
Your problem is more about the display of a text determined at runtime, and I see you have already opened a different forum thread for that. Be careful with the various way of using $ in NSIS : ${xxx} refers to a !define xxx (constant at compile-time) $(xxx) refers to a LangString xxx (translation) $xxx refers to a Var xxx (variable) $%xxx% refers to a Windows/DOS environment variable (defined at compile-time) My NSIS plug-ins: http://wiz0u.free.fr/prog/nsis.php |
|
|
|
|
|
#9 |
|
Member
Join Date: Oct 2009
Posts: 72
|
Thanks for your responses, MSG and Wizou!
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|