To extract a file from the installation archive at any time, you need to use the ExtractTemporaryFile procedure. This procedure extracts the file from the [Files] section to the temporary directory used by the installation application, which can be found at the path specified by the constant {tmp} . Then you simply copy the extracted file to the target directory, increasing the specified constant.
If you want to do something during installation initialization, but before creating the wizard form, use the InitializeSetup event function. Please note that you can even exit this function without seeing the wizard form, for example, if the file you are going to copy is very important. Here is a sample code, but first look at the commented version it for some details:
[Code] function InitializeSetup: Boolean; begin Result := True; ExtractTemporaryFile('File.exe'); if FileCopy(ExpandConstant('{tmp}\File.exe'), ExpandConstant('{reg:HKCU\SOFTWARE\XXX,InstallPath}\File.exe'), False) then MsgBox('File copying succeeded!', mbInformation, MB_OK) else MsgBox('File copying failed!', mbError, MB_OK) end;
TLama source share