NSIS文件下载器

时间:2011-12-19 10:41:25

标签: download 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”是什么? 我需要在程序的哪个部分编写这段代码(部分或函数)?

1 个答案:

答案 0 :(得分: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