如何在Inno Setup中静默安装Microsoft VC ++可再发行组件? [英] How to install Microsoft VC++ redistributables silently in Inno Setup?
本文介绍了如何在Inno Setup中静默安装Microsoft VC ++可再发行组件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Inno Setup中以静默方式安装Microsoft VC ++可再发行组件?我使用了以下代码,除安装进度窗口外,大多数安装部分处于静默状态.
How to install Microsoft VC++ redistributables silently in Inno Setup? I used the following code, most of the installation part is silent except the installation progress window.
这是我的[Run]
部分的代码:-
Here is my [Run]
section's code:-
[Run]
Filename: "{app}\bin\vcredist_x86.exe"; \
Parameters: "/passive /verysilent /norestart /q:a /c:""VCREDI~3.EXE /q:a /c:""""msiexec /i vcredist.msi /qn"""" """; \
Check: VCRedistNeedsInstall; WorkingDir: {app}\bin;Flags: runminimized nowait; \
StatusMsg: Installing CRT...
推荐答案
要顺利进行安装,请检查是否有必要安装可再发行组件.如果已安装的版本已经是最新版本(很有可能),甚至不要解压缩它.
For a smooth install, check if it's necessary to install the redistributable. If the installed version is already up to date (quite likely), don't even unpack it.
[Files]
; VC++ redistributable runtime. Extracted by VC2017RedistNeedsInstall(), if needed.
Source: ".\Redist\VC_redist_2017.x64.exe"; DestDir: {tmp}; Flags: dontcopy
[Run]
Filename: "{tmp}\VC_redist_2017.x64.exe"; StatusMsg: "{cm:InstallingVC2017redist}"; Parameters: "/quiet"; Check: VC2017RedistNeedsInstall ; Flags: waituntilterminated
[Code]
function VC2017RedistNeedsInstall: Boolean;
var
Version: String;
begin
if (RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64', 'Version', Version)) then
begin
// Is the installed version at least 14.14 ?
Log('VC Redist Version check : found ' + Version);
Result := (CompareStr(Version, 'v14.14.26429.03')<0);
end
else
begin
// Not even an old version installed
Result := True;
end;
if (Result) then
begin
ExtractTemporaryFile('VC_redist_2017.x64.exe');
end;
end;
请注意,14.14可再发行版也适用于VS2015.
Note that the 14.14 redistributable is also suitable for VS2015.
这篇关于如何在Inno Setup中静默安装Microsoft VC ++可再发行组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文