2013-03-18 50 views
0

我想學習NSIS爲項目創建一個安裝程序和一個卸載程序,我試圖按照教程部分中的示例。我想下面的腳本: -NSIS錯誤:無效的腳本:從來沒有OutFile命令

# define the name of the installer 
outfile "installer.exe" 

# define the directory to install to, the desktop in this case as specified 
# by the predefined $DESKTOP variable 
installDir $DESKTOP\Harshit\NSIS\Scripts 

# default section 
section 

# define the output path for this file 
setOutPath $DESKTOP\Harshit\NSIS\Files 

# define what to install and place it in the output path 
File test1.txt 

# define uninstaller name 
writeUninstaller $DESKTOP\Harshit\NSIS\Scripts\uninstaller.exe 

sectionEnd 

# create a section to define what the uninstaller does. 
# the section will always be named "Uninstall" 
section "Uninstall" 

# Always delete uninstaller first 
delete $DESKTOP\Harshit\NSIS\Scripts\uninstaller.exe 

# now delete installed file 
delete $DESKTOP\Harshit\NSIS\Scripts\Files\test1.txt 

sectionEnd 

但是,我得到一個錯誤,指出:

invalid script: never had OutFile command.

我可以在上面看到OUTFILE命令,但我想不出爲什麼它是不工作。有什麼建議嗎?

回答

4

難道它就像你在一個.nsi文件上工作一樣簡單,並且實際上將一個不同的.nsi文件傳遞給編譯器?

您可以添加!error "Hello World"或一些簡單的像,爲您的腳本來找出頂部...

編輯:

如果它無法打開輸出文件寫入錯誤消息應是「無法打開輸出文件」並且與OutFile無關。

除非您使用stdin傳遞腳本,否則應該選擇.nsi文件名作爲基本名稱,即使您根本不使用OutFile也是如此。

您能否使用您傳遞給makensis.exe的確切參數以及您真實腳本的副本?

+0

不,我再次檢查。我將正確的文件傳遞給編譯器。但是,在添加顯示的行後!error filename然後顯示相同的錯誤。我還更改了文件夾的權限以允許所有用戶寫入文件夾。 – user1439090 2013-03-18 09:09:03

相關問題