乙個NSIS打包指令碼

2021-08-28 07:20:25 字數 3291 閱讀 7927

;***nsis安裝指令碼

;--------------------------------

!include "mui2.nsh"

;--------------------------------

;general

!define companyname "***資訊科技****"

!define description "*** 1.0"

!define process_name "progressname"

!define main_exe_name "progressname"

!define abouturl ""

# these three must be integers

!define versionmajor 1

!define versionminor 0

!define versionbuild 0

!define installsize 415*1024

;name and file

outfile "***安裝包.exe"

var defaultinstalldir

;default installation folder

requestexecutionlevel admin

;--------------------------------

;inte***ce settings

!define mui_abortwarning

!define mui_icon "progressnamedg\icon\project.ico"

!define mui_unicon "progressnamedg\icon\project-uninstall.ico"

;--------------------------------

;pages

!insertmacro mui_page_welcome

!define mui_page_customfunction_show before_directory

!insertmacro mui_page_directory

!insertmacro mui_page_instfiles

!insertmacro mui_page_finish

!insertmacro mui_unpage_welcome

!insertmacro mui_unpage_confirm

!insertmacro mui_unpage_instfiles

!insertmacro mui_unpage_finish

;--------------------------------

;languages

!insertmacro mui_language "simpchinese"

;開始安裝時檢查是否正在執行

;$為自定義的常量

function .oninit

findprocdll::findproc "$.exe"

pop $r0

intcmp $r0 1 0 no_run

quit

no_run:

strlen $0 $defaultinstalldir

$ $0 > 0

strcpy $instdir $defaultinstalldir

$functionend

;開始解除安裝時檢查:

function un.oninit

findprocdll::findproc "$.exe"

pop $r0

intcmp $r0 1 0 no_run

quit

no_run:

functionend

; 如果已經是安裝過的, 禁用修改目錄的地方

function before_directory

strlen $1 $defaultinstalldir

$ $1 > 0

;禁用瀏覽按鈕

findwindow $0 "#32770" "" $hwndparent

getdlgitem $0 $0 1001

enablewindow $0 0

;禁止編輯目錄

findwindow $0 "#32770" "" $hwndparent

getdlgitem $0 $0 1019

enablewindow $0 0

$functionend

;--------------------------------

;installer sections

section "install"

; 釋放檔案

setoutpath "$instdir"

file /r progressnamedg\*.*

; 建立桌面快捷方式

;create uninstaller

writeuninstaller "$instdir\uninstall.exe"

# start menu

createdirectory "$smprograms\$"

createshortcut "$smprograms\$\解除安裝客戶端.lnk" "$instdir\uninstall.exe" "" "$instdir\icon\project-uninstall.ico"

; 寫入註冊資訊

# registry information for add/remove programs

# there is no option for modifying or repairing the install

# set the installsize constant (!defined at the top of this script) so add/remove programs can accurately report the size

sectionend

;--------------------------------

;uninstaller section

section "uninstall"

; 刪除檔案

rmdir /r $instdir

; 刪除桌面快捷方式

; 刪除開始選單

rmdir /r "$smprograms\$"

# remove uninstaller information from the registry

;刪除登錄檔項

sectionend

tar一些引數和乙個打包指令碼

c 建立新的檔案檔案。如果使用者想備份乙個目錄或是一些檔案,就要選擇這個選項。r 把要存檔的檔案追加到檔案檔案的末尾。例如使用者已經做好備份檔案,又發現還有乙個目錄或是一些檔案忘記備份了,這時可以使用該選項,將忘記的目錄或檔案追加到備份檔案中。t 列出檔案檔案的內容,檢視已經備份了哪些檔案。u 更新...

gxt工程打包指令碼

build.xml the directories where all the source information is located that is used to populate the target directory.the directory where all the interm...

iOS自動打包指令碼

最近比較對指令碼感興趣,但是學起來,感覺不但很多編輯器,而且指令碼種類眾多,而且實現方法也比較多,所以所學以shell指令碼為準,編輯器以vim,但是大同小異,大家也可以參考。首先貼上 bin sh 工程絕對路徑 cd 1 project path pwd build資料夾路徑 build path...