Archive: Commandline Extract .nsi?


Commandline Extract .nsi?
Hi all,

I'm having a bit of difficulty creating a "hidden" section that extracts the .nsi files when presented with a commandline option. Basically, I want to bundle the .nsi files with the installer, and if I run setup.exe /WITHSOURCE or something, it also extracts the .nsi files to the install dir.

Putting together the three required pieces into a working solution is giving me trouble.

1) disable the hidden "extract source" section by default.
2) check commandline for /WITHSOURCE, re-enable the hidden section that extracts the source if the commandline option was there.
3) extract the source. I dont really need it to extract a full source, just the original .nsi file.

Has anyone done something like this in their installer, and could give me a tip, pointers, or an example? I greatly appreciate it.


1) /o switch as specified in the documentation.
2) See GetOptions in the documentation.
3) Use the SelectSection macro in Sections.nsh

-Stu


Thank you Stu.


I have something similar implemented with nfUtils.nsh (http://nsis.sourceforge.net/NfUtils_header_file). ${nfu.ProcessStdSwitches} checks for a /X or /E switch, which lets you extract or explore files which you have included with the macro ${nfu.!AddFile} to your setup.exe without actually running your sections.

Have a look at the installer for the header (nfUtils.nsi) for examples.