在静默模式下安装VC++Redist 2008



我想在NSIS安装脚本中安装VC++Redist 2008。我得到了以下脚本:

; Test if Visual Studio Redistributables 2005+ SP1 installed
; Returns -1 if there is no VC redistributables intstalled
Function CheckVCRedist
   Push $R0
   ClearErrors
   ReadRegDword $R0 HKLM "SOFTWAREMicrosoftWindowsCurrentVersionUninstall{7299052b-02a4-4627-81f2-1818da5d550d}" "Version"
   ; if VS 2005+ redist SP1 not installed, install it
   IfErrors 0 VSRedistInstalled
   StrCpy $R0 "-1"
VSRedistInstalled:
   Exch $R0
FunctionEnd

基本上它适用于VC++Redist 2005,但我已经编辑了reg设置,以检查是否存在2008(可以这样做吗?)。我需要一段脚本/命令来安装VC++Redist 2008。

  • 我在哪里存储VC设置以及如何在静默模式下执行
  • .onInit检查可以吗

请有人提供一个完整的脚本,检查是否存在,以及如何在静音模式下执行。

谢谢,

我不太确定如何检查是否已经从注册表安装了vcredist。我为安装程序所做的是,在系统中检查vcredist安装的特定dll文件(我正在为其安装vcredist)。因此,如果该文件存在于我的$WinDir中,我假设vcredist已经安装,否则我将下载&以静默方式安装vcredist

以下是我的脚本,可能会对你有所帮助:

ifFileExists $WindirSystem32mfc100.dll +2 0
StrCpy $IsMfcInstalled "no"
${If} $IsMfcInstalled == "no"    
download1:
NSISdl::download "http://download.microsoft.com/download/5/B/C/5BC5DBB3-652D-4DCE-B14A-475AB85EEF6E/vcredist_x86.exe"  "$Temp/vcredist_x86.exe"
pop $0
StrCmp "$0" "success" execStep1 instAbort1
execStep1:
Execwait '"$Temp/vcredist_x86.exe" /q' ; '/q' to install silently
pop $0
StrCmp "$0" "success" done execStep1
instAbort1:
StrCmp $0 "cancel" 0 +1
MessageBox MB_OKCANCEL "Connection Timed Out. Retry ? " IDOK  download1 IDCANCEL 0
Quit
${else}
goto done
${endIf}
done:

最新更新