ChrisGue
Posts: 93
Joined: Tue Feb 03, 2009 7:26 pm

pass a file via the command line

Hello,

I use the AI enterprise 7.1.3

I would like (optionally) to pass a file via the command line to the installer exe.
In case a file is passed via the command line, it shall be copied to the program folder.

e.g:
MyInstallation.exe /ADDTHIS="c:\test\settings.ini"

Is this possible? If so, how?

Chris
Bogdan
Posts: 2791
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: pass a file via the command line

Hi Chris,

if you have the Enterprise edition you could do something. The following Browse For File tutorial is showing you how to select a file to be installed by your package.

If you look carefully in the tutorial you will see the file path select selected is stored into a property, so in theory you can set that path from the command line too.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ChrisGue
Posts: 93
Joined: Tue Feb 03, 2009 7:26 pm

Re: pass a file via the command line

Thanks for the answer,

Yes, that's working.

But when I use the parameter /passive the file not being copied.
e.g.
Myinstallation.exe ADDFILE="x:\datas\settings.zip" works fine
Myinstallation.exe /passive ADDFILE="x:\datas\settings.zip" is not working

I have added the custom action in Commit,with 'Synchronous execution, ignore return code.' and Extecution option set to 'Commit' and 'Always execute'
condition is ADDFILE<>""

any idea?
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: pass a file via the command line

Hello,

As another solution in order to achieve what you want you can simply use your own custom action which will copy the passed file (from command line) to the desired location. For example, if you want to copy the file under the "Application Folder", then you can proceed like this:
1. create a BAT file (e.g. copy.bat) with the following content:

Code: Select all

xcopy /y %1 %2
2. add the above BAT file as a temporary file in "Files and Folders" page
3. go to "Custom Actions" page and add a "Launch file" custom action with sequence, scheduled after "Install Execution Stage -> Add Resources" actions group, like this:
  • File To Launch: [&copy.bat]
    Command Line: "[ADDFILE]" "[APPDIR]"
    Hid program's window: checked
4. configure the above custom action to run as deferred with no impersonation
5. build and test your installation scenario (Myinstallation.exe /passive ADDFILE="x:\datas\settings.zip")

If you have any questions let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ChrisGue
Posts: 93
Joined: Tue Feb 03, 2009 7:26 pm

Re: pass a file via the command line

Thanks, with deferred with no impersonation this is working now.
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: pass a file via the command line

You're welcome. I'm glad you got this working.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”