快活林资源网 Design By www.csstdc.com

复制代码 代码如下:
;我的第一个安装脚本
!include "MUI2.nsh"
!define DIR "D:\workspace\nsis\files"

Name "安装程序"
Icon "${DIR}\setup128.ico"
OutFile "setup.exe"
InstallDir "$PROGRAMFILES\kaserv"
RequestExecutionLevel admin

!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_LANGUAGE "SimpChinese"

Function .onInit
 System::Call 'kernel32::CreateMutexA(i 0,i 0,t "SMAPLE_MUTEX") i .r1 ?e'
 Pop $R0
 StrCmp $R0 0 +3
 MessageBox MB_OK|MB_ICONSTOP "只允许运行一个实例"
 Abort
FunctionEnd

;安装程序段
Section
SetOutPath $INSTDIR
File "${DIR}\新建文本文档 (2).txt"
File "${DIR}\新建文本文档.txt"
SetOutPath "$INSTDIR\office"
File "${DIR}\office\*"
;快捷方式
CreateShortCut "$DESKTOP\test.lnk" "$INSTDIR\unsetup.exe"
CreateShortCut "$SMPROGRAMS\test.lnk" "$INSTDIR\unsetup.exe"
WriteUninstaller "$INSTDIR\unsetup.exe"
SectionEnd

;卸载程序段
Section "Uninstall"
RMDir /r "$INSTDIR"
Delete "$DESKTOP\test.lnk"
Delete "$SMPROGRAMS\test.lnk"
SectionEnd

快活林资源网 Design By www.csstdc.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
快活林资源网 Design By www.csstdc.com