- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在安装软件之前,我需要检查 Visual C++ 2017 redistributable(x86)
是否安装。如果未安装,则在先安装软件时,我可以安装可再发行可执行文件。
当我手动安装它时,它显示在以下路径中:
Computer\HKEY_CLASSES_ROOT\Installer\Dependencies\VC,redist.x86,x86,14.16,bundle\Dependents\{67f67547-9693-4937-aa13-56e296bd40f6}
NSIS
检查上述路径?
!insertmacro MUI_LANGUAGE "English"
Section "MyApp"
SetOutPath $INSTDIR
File "\Desktop\Common\vcredist_x86.exe"
ExecShell "" "$INSTDIR\vcredist_x86.exe"
SectionEnd
最佳答案
更简单的版本,使用“版本”字符串键和字符串比较。
Section "CheckVCRedist"
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" "Version"
DetailPrint "Found version $0"
; Check for 14.16.27027 [sic]
${If} $0 >= "v14.16.27024.01"
DetailPrint "The installed version is usable"
${Else}
DetailPrint "Must install redist"
${EndIf}
SectionEnd
Section /o VCRedist VCRedist_id
; Use the "pluginsdir"; it's really the NSIS temp dir, and it's cleaned up at the end.
InitPluginsDir
SetOutPath "$pluginsdir"
; Finding the correct redistributable is a bit of a problem. MSVC itself ships with an
; appropriate redistributable. It's location will likely be similar to
; C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.16.27012
; but the exact location of the Redist folder can differ. That's why vswhere.exe is used.
; Note that the vswhere used is the local one, NOT the one from
; Visual Studio itself (finding that would be a chicken-and-egg problem). This version
; is new enough to support the -find parameter, which is what we need to find the
; redistributable. Stuff the result in a temporary redist.path file.
!system 'vswhere.exe -latest -find "VC/Redist/**/vc_redist.x64.exe" > redist.path'
!define /file REDISTPATH redist.path
; Check what version we found. This is used to decide at install time whether we need to
; unpack this redistributable.
!getdllversion "${REDISTPATH}" RedistVer
!echo "Including VC++ Redistributable Version ${RedistVer1}.${RedistVer2}.${RedistVer3}.${RedistVer4}"
SetCompress off
File "${REDISTPATH}"
SetCompress auto
; Cleanup the temporary redist.path file which held the output of vswhere -find
!system 'del redist.path'
ExecWait "vc_redist.x64.exe"
SectionEnd
Function VCRedistNeeded
SetRegView 64
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" "Version"
DetailPrint "Found version $0"
${If} $0 >= "v${RedistVer1}.${RedistVer2}.${RedistVer3}.${RedistVer4}"
DetailPrint "VC++ redistributable already present"
${Else}
DetailPrint "Installing VC++ redistributable."
SectionSetFlags ${VCRedist_id} 1 ; Selected
${EndIf}
FunctionEnd
关于nsis - 如何使用 NSIS 检查是否安装了 Visual C++ 2017 可再发行组件 x86,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54390195/
我有一个安装程序,一个编译好的 NSIS 脚本,它首先检查我的应用程序的另一个版本是否正在系统上运行。如果存在另一个实例,则它首先触发静默卸载,然后继续安装新实例。 我使用 ExecWait 在静默模
我必须比较当前文件的版本和已经安装在 NSIS 安装程序中的版本。我知道版本号是字符串,但我在几个地方读到,如果逻辑操作需要,NSIS 会自动将字符串转换为整数。 仅出于测试目的,我编写了以下脚本:
我们有一个包含多个组件的安装程序,每个组件都有自己的部分。我试图找出我们现有的代码如何实际设置每个部分的大小。我们有 3 个组件,如果选中/取消选中,它们将更新组件页面上的“所需空间”值。 我当前添加
我正在努力将图像添加到用NSIS/MUI2编写的安装程序的第一页中。 这是我正在使用的代码的精简版。 !include "MUI2.nsh" !define MUI_HEADERIMAGE !
NSIS具有您在脚本中定义的Name变量: Name "MyApp" 它定义了安装程序的名称,并显示为窗口标题等。 有没有办法将.NET版本号从我的主EXE中拉出来并将其附加到名称中? 这样我的安装程
当我运行静默 NSIS 安装程序时(从控制台,如 installer.exe/S/D=C:\Foo),它会立即移至后台。我想等到它完成安装后再做其他事情。我可以传递一个标志来告诉安装程序要阻止吗? 最
字符串 "jdbc:postgresql://localhost:5432/DatabaseName" 我的要求是只获得 数据库名称 从上面的字符串。 我试过下面的链接,但没有用。 ${Explode
我需要使用 SVN 标签 $Revision$在 NSIS 脚本中。显然,NSIS 编译器将这个 $Revision 理解为一个变量。我怎么能逃过这块钱呢? 我试过反斜杠,它不起作用。 最佳答案 Me
我有一个 NSIS 脚本要求用户提供安装目录,但我想要求用户在新页面上再提供一个临时目录。有没有一种方法可以使用 nsDialogs 添加一个新页面,它为例如 指定一个临时目录 C:\temp 还让他
我正在使用 VS 2010 为 NSIS 构建一个插件,我很想设置该项目,以便从简单的 NSI 文件自动构建测试设置。 一切似乎都很好,只是我不知道如何让 NSIS 在我的项目的输出文件夹而不是 C:
如果选择了某个组件,我想提示用户提供额外信息,但我不确定如何检查是否选择了给定的组件。好像http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.13.2
在我的安装程序中,我想创建一个空文件。在 linux 中,我会使用 touch 命令,但是在 NSIS 中最简单的方法是什么? 最佳答案 #Compile time !appendfile "$%te
在构建我的安装程序时,我可以让用户通过调用来选择要安装的部分 !insertmacro MUI_PAGE_COMPONENTS 如何在卸载程序中提供类似的功能? 我知道如何自己制作这些部分(感谢 th
我试图通过从外部传递版本号来概括一个安装文件。我希望能够做到这一点: makensis myscript.nsi parameter=value 然后读取脚本中的参数,以便使用相同的脚本生成不同版本的
我正在尝试使我的设置脚本模块化。我根据要求从主安装脚本中调用 setup exe。我想将命令行参数传递给被调用的 exe。有人可以告诉我如何访问被调用脚本中的命令行参数。 提前致谢。 最佳答案 您可以
我使用 NSIS 开发了一个安装程序.每次重新安装应用程序时,我都想创建现有数据库文件的备份。 如何使用以下格式“当前日期时间”重命名这些数据库文件(例如:201003101140 表示 2010-0
有人可以帮我删除 NSIS 安装程序中的“Nullsoft”标签吗?请引用下图。 最佳答案 BrandingText " " 关于nsis - 从 NSIS 安装程序中删除品牌,我们在Stack Ov
如何确定我的 NSIS 函数是否有可用的互联网连接? 我看到了 Intec 插件,但我没有找到怎么做 谢谢。 最佳答案 你应该为此使用 Dailer 插件。 试试这个: Dialer::GetConn
我是 NSIS 脚本的新手。我想创建一个自定义安装程序,它将环绕另一个安装程序 (FEKO)。此方法Embedding other installers NSIS 网站上的建议对我不起作用 脚本编译正
我对 NSIS 很陌生。 我正在尝试请求管理员权限以运行安装程序,因为它与注册表有些困惑。 我对“RequestExecutionLevel”和“MULTIUSER_EXECUTIONLEVEL”的问
我是一名优秀的程序员,十分优秀!