Skip to content

Instantly share code, notes, and snippets.

@hoozh
Created January 4, 2017 02:33
Show Gist options
  • Save hoozh/42758dcc6911d1d283b8bb88f8acc26d to your computer and use it in GitHub Desktop.
Save hoozh/42758dcc6911d1d283b8bb88f8acc26d to your computer and use it in GitHub Desktop.
nsis install vcredist
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; install vcredist
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SetOutPath "$varTempFolder\${PRODUCT_NAME_EN}Setup\3rdparty"
SetOverWrite on
StrCpy $varVCRedistKey "c1c4f01781cc94c4c8fb1542c0981a2a"
Call CheckVCRedist
Pop $R0
${If} $R0 == "-1"
File "${3RDPARTY_FOLDER}\vcredist_x86_2005.exe"
;C:\Users\zh\AppData\Local\Temp\vcredist_x86.exe /q:a /c:"VCREDI~3.EXE /q:a /c:""msiexec /i vcredist.msi /qn"" "
ExecWait "$varTempFolder\${PRODUCT_NAME_EN}Setup\3rdparty\vcredist_x86_2005.exe /q:a /c:$\"msiexec /i vcredist.msi /qn /l*v $varTempFolder\vcredist_x86.log$\""
${EndIf}
StrCpy $varVCRedistKey "6F9E66FF7E38E3A3FA41D89E8A906A4A"
Call CheckVCRedist
Pop $R0
${If} $R0 == "-1"
; install vcredist_x86 2008
File "${3RDPARTY_FOLDER}\vcredist_x86_2008.exe"
Execwait '"$varTempFolder\${PRODUCT_NAME_EN}Setup\3rdparty\vcredist_x86_2008.exe" /q' ; '/q' to install silently
${EndIf}
; install vcredist_x86 2013
; File "${3RDPARTY_FOLDER}\vcredist_x86_2013.exe"
; ExecWait "$varTempFolder\${PRODUCT_NAME_EN}Setup\3rdparty\vcredist_x86_2013.exe /install /quiet /norestart /log %TEMP%\vcredist_2013_x86.log"
Function CheckVCRedist
${If} $varVCRedistKey == ""
DetailPrint "no vcredist need to be check"
Goto VSRedistInstalled
${EndIf}
Push $R0
ClearErrors
ReadRegDword $R0 HKLM "SOFTWARE\Classes\Installer\Products\$varVCRedistKey" "Version"
; if vc redist not installed, install it
IfErrors 0 VSRedistInstalled
StrCpy $R0 "-1"
VSRedistInstalled:
Exch $R0
FunctionEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment