Page 1 of 1

Copying files from installation folder at runtime

Posted: Mon Nov 30, 2020 2:55 pm
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!

Re: Copying files from installation folder at runtime

Posted: Tue Dec 01, 2020 1:27 pm
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.

Re: Copying files from installation folder at runtime

Posted: Wed Dec 02, 2020 1:07 pm
by Edhy
Hi Francesco,

Thanks a lot, that will definitely get me started in the right direction.

Re: Copying files from installation folder at runtime

Posted: Fri Dec 04, 2020 2:33 pm
by FrancescoT
:D