我尝试通过在我的exe中安装jre引用这个link
Function installjre
SetOutPath '$TEMP'
SetOverwrite on
File lib\jre.exe
Exec $TEMP\jre.exe $0
FunctionEnd
我已经使用过上面的内容并且效果很好。
问题:
- 如何在后台进程安装jre?可以以静默模式安装jre吗?
- 默认情况下,jre 将采用
c:\program files\java\jre
,我需要在运行静默模式时将此路径更改为$INSTDir\jre
我尝试过以下命令,但似乎不起作用
Exec /silent $TEMP\jre.exe $0
如何解决以上两个问题?
最佳答案
在 JRE Installer Options 的在线文档中人们可以阅读:
<jre>.exe [/lang=] [/s] [IEXPLORER=1] [MOZILLA=1] [INSTALLDIR=:\] [STATIC=1]
选项的详细信息:
/s, if used, indicates silent installation
还有
INSTALLDIR, if used, specifies the drive and path of the installation If INSTALLDIR is not specified, the installation will go into C:\Program Files\java\jre1.6.0 (default location).
因此,jre 设置的正确调用是
ExecWait '"$TEMP\jre.exe" /s INSTALLDIR=$INSTDir\jre'
注意 ExecWait
和引号的用法。
引用此link也来自转义引号。
关于nsis - 通过NSIS安装时如何使用后台进程安装jre?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16960051/