我试图将 JRE 的目录复制到我的安装目录,但编译器说没有这样的文件,但是当我运行我的安装时,我把它放在标签上,它显示了目录路径。我知道 File 只接受预编译的变量,但没有解决方法?我对 2 天前刚刚开始的 NSI 脚本非常陌生,我尝试获取 JRE 的位版本,但仍然没有运气如何做到这一点......
这是我尝试复制并获取位版本但失败的代码:
Var jredir
RequestExecutionLevel admin
Function nsDialogsPage
nsDialogs::Create 1018
${NSD_CreateLabel} 0 0 100% 12u "Cheking for JRE information..."
Pop $Label
ReadRegStr $0 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" CurrentVersion
${NSD_CreateLabel} 0 15 100% 12u "JRE version: $0"
Pop $Label
${NSD_CreateLabel} 0 30 100% 12u "JRE bit: xx"
Pop $Label
ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$0" "JavaHome"
StrCpy $jredir $1
${NSD_CreateLabel} 0 45 100% 12u "JRE directory: $1"
Pop $Label
IfFileExists "$jredir" CopyJRE GetJRE
CopyJRE:
SetOutPath $INSTDIR
File /r "$jredir"
GetJRE:
${NSD_CreateLink} 0 183 100% 12u "Download JRE"
Pop $Link
${NSD_OnClick} $Link onMyLinkClick
nsDialogs::Show
FunctionEnd
Function onMyLinkClick
Pop $0
ExecShell "open" "http://www.java.com/en/download/index.jsp"
FunctionEnd