2011-12-19 74 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