Copying files from installation folder at runtime

Got a problem you cannot solve? Try here.
Post Reply
Edhy
Posts: 138
Joined: Sun Jul 31, 2005 4:09 pm
Location: New York, USA

Copying files from installation folder at runtime

Post by Edhy »

Hi all,
I have a case where my install will need to copy 2 files "*.dat" from the same folder where the setup.exe is being executed.
These files are not included in the setup.exe but I would like my setup.exe to look for these 2 files in the same folder and if found, then copy them to a specific folder as part of the installation.

If this possible? if so, can anybody provide a sample code of the script?

Thanks a lot!
Edhy Rijo
Thom Child and Family Services
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Copying files from installation folder at runtime

Post by FrancescoT »

You may use the "Copy/Move Local Files " command as below:

Code: Select all

Set Variable NATIVE_ENGINE to TRUE
Copy Local Files $SETUPPATH$\MyFile.dat to c:\MyfolderSet Variable NATIVE_ENGINE to FALSE

Code: Select all

~InstallAware Clipboard Data~
~Set Variable~
~{63F3FFF3-A60E-46D4-AA16-0D4BB4683398}~
~NATIVE_ENGINE$MYAH$MYAH$FALSE~
~FALSE~
~Copy/Move Local Files~
~{03F7929C-6C58-4078-A3A2-495676CD71BA}~
~$SETUPPATH$~
~MyFile.dat~
~c:\Myfolder~
~~
~TRUE~
~FALSE|FALSE~
~Set Variable~
~{A7B1ACDD-5203-483E-8A59-8DD716EDCDA7}~
~NATIVE_ENGINE$MYAH$MYAH$FALSE~
~TRUE~
Here I used the SETUPPATH pre-defined variable to obtain "the outermost folder containing the executable program or setup database that initiated the installation".
(*) "Copy/Move Local Files" is a Windows Installer Command, by default its execution is deferred to "Apply Install" execution. To overcome such behavior, I used the IA NATIVE ENGINE to force an immediate execution of the command.

Hope this helps you.
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Edhy
Posts: 138
Joined: Sun Jul 31, 2005 4:09 pm
Location: New York, USA

Re: Copying files from installation folder at runtime

Post by Edhy »

Hi Francesco,

Thanks a lot, that will definitely get me started in the right direction.
Edhy Rijo
Thom Child and Family Services
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Copying files from installation folder at runtime

Post by FrancescoT »

:D
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Post Reply