views:

23

answers:

2

I have created an installer using Inno Setup in which I am executing an exe that I created to create a small service inside Windows XP. I need to pass two arguments to the exe - "-install" and the path of the installation directory. I have no way of expanding the constant {app} to pass the actual value inside of {app}. Is there some way of doing this?

Thanks

A: 

I do not really understand what you want, but maybe you are seeking the ExpandConstant function?

Andreas Rejbrand
Yes, I am aware of ExpandConstant but even that does not allow me to pass the installation path as an argument. If I do thisExec(ExpandConstant('{src}\Depends\myEXe.exe'), '-install "ExpandConstant('{app}')"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);it wont put the {app} path as the argument. Instead, it will put ExpandConstant({app}) as the argument. Is there a way of getting around this is my question.I hope this is clearer
Rishi
@Rishi: Of course it does. `ExpandConstant` is a part of the string literal!
Andreas Rejbrand
A: 

This should work:

[Run]
Filename: {app}\MyApp.exe; Parameters: "-install {app}";

I've done it before using InnoSetup and it puts the correct value for {app}.

If you are still having problems, please post your code.

mirtheil
True. For now, I am using [Run] instead of the Exec function inside [Code]. I was just wondering if someone knew how to use Exec function to run the exe and pass the app path as an argument
Rishi
In that case, something like this should work: Exec(ExpandConstant('{app}\MyApp.exe'), '-install "' + ExpandConstant('{app}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
mirtheil