Archive: Exec in directory?


Exec in directory?
I've serched for this several times, on the forums, the help file, google, and the wiki, but I still haven't found the answer.

I know that there's an Exec command, but it seems to run the program in the installer directory. Is there a way to run the program in a directory specified by the scripter (or at least the directory that the program is in?) example of this: place the entire nsis folder inside a folder called nsisProgram. Make a new nsi file with all the normal stuff, and make it run
exec $EXEDIR\nsisProgram\nsis.exe. You get a blank window.

help?

elyea

p.s. first post!


did you even read the documentation for exec at 4.9.1.2 ?


Originally posted by Anders
did you even read the documentation for exec at 4.9.1.2 ?
err... *reads again.*
4.9.1.2 Exec
command
Execute the specified program and continue immediately. Note that the file specified must exist on the target system, not the compiling system. $OUTDIR is used for the working directory. The error flag is set if the process could not be launched. Note, if the command could have spaces, you should put it in quotes to delimit it from parameters. e.g.: Exec '"$INSTDIR\command.exe" parameters'. If you don't put it in quotes it will not work on Windows 9x with or without parameters.

Exec '"$INSTDIR\someprogram.exe"'
Exec '"$INSTDIR\someprogram.exe" some parameters'
i must be blind.

elyea

just wondering... is this this an example of "Nice" around here, your method of treating ignorant newbies, or just plain "YOU ARE AN IDIOT"?

Most people here are very nice (I wonder how some (Red Wine, kichik) can be so patient all of the time.) Don't take offense at one response. Read some of the other posts here and you'll see how it is most of the time.

Don


@ testrie,
$EXEDIR is a constant that indicates the full path of directory where your installer is running.
Find more info about constants variables etc at nsis documentation.
http://nsis.sourceforge.net/Docs/Chapter4.html#4.1

You are able to run any exe that exists on a target with command Exec as long as you pass to the command the full path to the file, if you don't, the installer looking for the file into the current dir where is pointed by SetOutPath.

Compile and execute the following example, it'd help you on these,

Name "My Application"
OutFile 'test.exe'
ShowInstDetails show
LicenseData '${NSISDIR}\License.txt'
LicenseBkColor 0xFFFFFF
InstallDir '$PROGRAMFILES\$(^name)'

Page License
Page Components
Page Directory
Page InstFiles

Section "boo"
SetOutPath '$INSTDIR'
File /r '${NSISDIR}\*'
Exec 'nsis.exe'
Exec '$WINDIR\notepad.exe'
DetailPrint '------------------'
DetailPrint 'Some Constants'
DetailPrint '$EXEDIR'
DetailPrint '$INSTDIR'
DetailPrint '$PROGRAMFILES'
DetailPrint '$WINDIR'
MessageBox MB_YESNO|MB_ICONQUESTION \
"Remove $INSTDIR now?" IDYES remove
MessageBox MB_OK "you should manually remove $INSTDIR later" IDOK end
remove:
;take care of this command dont use it in your script unless you know everything about it
RmDir /r '$INSTDIR'
end:
SectionEnd

no, i guess what he wants to do is to change $OUTDIR.

again, read the manuals ;)

SetOutPath "C:\Program Files\whatever"
Exec "$OUTDIR\mytool.exe"

and you're done :)