InnoSetup has a function ExtractTemporaryFile that can extract a file temporarily Instead of installing it). E.g. to extract and run a 3rd party installer during setup.
This function only takes a filename, so if there are multiple files with the same name you wish to treat this way, it doesn't work.
How can this be handled without renaming the source files?
Has been answered on the InnoSetup user voice forum:
ExtractTemporaryFile cannot currently distinguish by destination directory, it is possible to rename the DestName so one can differentiate the files without renaming the source:Example:
; 2005 redist
Source: Source\Redist\vcredist_x86.exe; Flags: dontcopy
; 2010 redist 
Source: Source\Redist\2010\vcredist_x86.exe; DestName: vcredist_x86_2010.exe; Flags: dontcopy
Later you can refer to the unique file names without having to rename the input to the setup.
Full credits go to dave
When you have a recent Inno Setup version, there's also ExtractTemporaryFile*s*, which can use wildcards by destination directory, so the way to go is:
[Files]
Source: Source\Redist\*.*; DestDir: redist_bundle; Flags: dontcopy recursesubdirs
[Code]
...
ExtractTemporaryFiles('redist_bundle\*');
//                _-^-_
This will extract the subtree below the Redist source to inno's temporary directory. Note that I omitted any {app} or {tmp} constant in the DestDir and subsequently also in the Extract.. function.
This way, the files will be extracted as, e.g.
...
[12:16:32,105]   Extracting temporary file: C:\Users\me\AppData\Local\Temp\is-xyz.tmp\redist_bundle\ucrt-redist-10586\Windows6.1-KB3118401-x64.msu
[12:16:32,145]   Extracting temporary file: C:\Users\me\AppData\Local\Temp\is-xyz.tmp\redist_bundle\vcredist-2005\vcredist_x86.exe
[12:16:32,167]   Extracting temporary file: C:\Users\me\AppData\Local\Temp\is-xyz.tmp\redist_bundle\vcredist-2010\vcredist_x64.exe
[12:16:32,230]   Extracting temporary file: C:\Users\me\AppData\Local\Temp\is-xyz.tmp\redist_bundle\vcredist-2010\vcredist_x86.exe
[12:16:32,279]   Extracting temporary file: C:\Users\me\AppData\Local\Temp\is-xyz.tmp\redist_bundle\vcredist-2013\vcredist_x64.exe
[12:16:32,318]   Extracting temporary file: C:\Users\me\AppData\Local\Temp\is-xyz.tmp\redist_bundle\vcredist-2013\vcredist_x86.exe
[12:16:32,358]   Extracting temporary file: C:\Users\me\AppData\Local\Temp\is-xyz.tmp\redist_bundle\vcredist-2015\vc_redist.x64.exe
[12:16:32,437]   Extracting temporary file: C:\Users\me\AppData\Local\Temp\is-xyz.tmp\redist_bundle\vcredist-2015\vc_redist.x86.exe
[12:16:32,512]   Extracting temporary file: C:\Users\me\AppData\Local\Temp\is-xyz.tmp\redist_bundle\vcredist-2017\vc_redist.x64.exe
[12:16:32,591]   Extracting temporary file: C:\Users\me\AppData\Local\Temp\is-xyz.tmp\redist_bundle\vcredist-2017\vc_redist.x86.exe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With