2011-12-19 72 views
1

我需要从互联网上下载NSIS脚本文件并执行它。 我读过很多例子,但我仍然不明白如何去做。例如,NSIS文件下载器

NSISdl::download http://www.domain.com/file localfile.exe 
    Pop $R0 ;Get the return value 
     StrCmp $R0 "success" +3 
     MessageBox MB_OK "Download Failed: $R0" 
     Quit 

$ R0包含有关安装过程(“取消”或“成功”)的信息。但我不明白“localfile.exe”是什么? 在我需要编写这段代码(节或函数)的程序的哪一部分?

+0

两个部分和功能包含代码(和插件调用),只有安装程序的属性部分超出了规定/功能... – Anders 2011-12-19 11:38:51

回答

3

localfile.exe是要保存内容您正在下载的本地系统上的路径:

!include LogicLib.nsh 
Section 
NSISdl::download "http://cdn.sstatic.net/stackoverflow/img/sprites.png" "$pluginsdir\image.png" 
Pop $0 
${If} $0 == "success" 
    ExecShell "" '"$pluginsdir\image.png"' ;Open image in default application 
${Else} 
    MessageBox mb_iconstop "Error: $0" ;Show cancel/error message 
${EndIf} 
SectionEnd