Archive: Help on running a file from a section!


Help on running a file from a section!
Hello everyone,

I am an NSIS newbie and I am quite puzzled with a question.

I have created several sections within my installer that represent optional installation components. I would like to execute an external program if the user has checked a particular section.

The section commands -as far as I know- do not include an execution command, but only extraction/copy commands etc. I have read the NSIS manual but haven't found anything about my problem. Can you please provide any help?

Thanks.


Did you try using the Exec, ExecWait, or ExecShell commands? Kinda like this:

Section "Launch External Program"
Exec '"Program" args'
SectionEnd

Refer to the manual for the differences between the different commands.


Originally posted by Fightin_Foo
Did you try using the Exec, ExecWait, or ExecShell commands?
Yes, I'm afraid I've tried that. It compiles with no problem but the generated installer doesn't really execute the desired file.

Section "Install Microsoft .NET Framework 2.0 Runtime" SEC05
ExecWait ‘"$EXEDIR\Prerequisites\dotnetfx.exe"’
SectionEnd


Is there something I'm doing wrong?

EDIT: Alright, solved it.. When you execute the application without any args, you should omit the single quotes in order for the whole thing to work. Thanks for helping out anyway.

PS. I gotta admit, I'm quite impressed by NSIS's potential and capabilities :up:

No it's because you're using the wrong quotes. Use ` " or ' not ‘ and ’. Interesting that makensis.exe doesn't throw an error but you will find using `"$SYSDIR\notepad.exe"` works and ‘"$SYSDIR\notepad.exe"’ does not.

Stu