InnoSetup有一个函数ExtractTemporaryFile
,可以临时提取文件而不是安装它。例如。在安装过程中提取并运行第三方安装程序。
这个函数只接受一个文件名,所以如果有多个同名的文件你想用这种方式处理,它就不起作用了。
如何在不重命名源文件的情况下处理这个问题?
答案 0 :(得分:2)
已经answered on the InnoSetup user voice forum:
ExtractTemporaryFile
目前无法通过目标目录进行区分,但可以重命名DestName
,以便可以在不重命名源的情况下区分文件:示例:
; 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
稍后您可以参考唯一的文件名,而无需将输入重命名为设置。
完整学分转到dave
当你有一个最近的Inno安装版本时,还有ExtractTemporaryFile*s*
,它可以按目的地目录使用通配符,所以要走的路是:
[Files]
Source: Source\Redist\*.*; DestDir: redist_bundle; Flags: dontcopy recursesubdirs
[Code]
...
ExtractTemporaryFiles('redist_bundle\*');
// _-^-_
这会将Redist源下面的子树提取到inno的临时目录。请注意,我在{app}
中以及随后的{tmp}
函数中省略了DestDir
或Extract..
常量。
这样,文件将被提取为例如
...
[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