还在苦苦敲代码开发APP?你out啦! 试试积木搭建APP吧~

NSIS做的安装程序,可接受命令行参数,实现静默安装,静默卸载

来源:清泛原创     2016-06-28 09:39:08    人气:     我有话说( 0 人参与)

命令参数 D=xxx 可以指定安装包的安装路径,覆盖安装包中设置的默认路径及注册表中默认路径。但是, D= 后面一定不能有引号(不能写成...

命令参数 /D=xxx 可以指定安装包的安装路径,覆盖安装包中设置的默认路径及注册表中默认路径。

但是,/D= 后面一定不能有引号(不能写成 /D="xxx"),否则不生效,仍然按照安装包中的默认路径安装。
 


更多请参考英文资料:

Generated installers and uninstallers accept a few options on the command line. These options give the user a bit more control over the installation process.

3.2.1 Common Options
  • /NCRC disables the CRC check, unless CRCCheck force was used in the script.
  • /S runs the installer or uninstaller silently. See section 4.12 for more information.
  • /D sets the default installation directory ($INSTDIR), overriding InstallDir and InstallDirRegKey. It must be the lastparameter used in the command line and must not contain any quotes, even if the path contains spaces. Only absolute paths are supported.
3.2.2 Uninstaller Specific Options
  • _?= sets $INSTDIR. It also stops the uninstaller from copying itself to the temporary directory and running from there. It can be used along with ExecWait to wait for the uninstaller to finish. It must be the last parameter used in the command line and must not contain any quotes, even if the path contains spaces.
3.2.3 Examples

installer.exe /NCRC
installer.exe /S
installer.exe /D=C:\Program Files\NSIS
installer.exe /NCRC /S /D=C:\Program Files\NSIS
uninstaller.exe /S _?=C:\Program Files\NSIS

# uninstall old version
ExecWait '"$INSTDIR\uninstaller.exe" /S _?=$INSTDIR'

NSIS 安装程序 参数 静默安装

注:本文为本站或本站会员原创优质内容,版权属于原作者及清泛网所有,
欢迎转载,转载时须注明版权并添加来源链接,谢谢合作! (编辑:admin)
分享到: