basic help
http://nsis.sourceforge.net/Main_Page
http://www.kippler.com/doc/nsis/
tutorial
http://nsis.sourceforge.net/Category:Tutorialssample
http://nsis.sourceforge.net/Category:Code_Exampleshttp://nsis.sourceforge.net/A_simple_installer_with_start_menu_shortcut_and_uninstaller
download
http://nsis.sourceforge.net/Downloaduseful links
no?basic usage
sample.nsi; sample.nsi;; This script is based on example1.nsi, but it remember the directory,; has uninstall support and (optionally) installs start menu shortcuts.;; It will install Sample.nsi into a directory that the user selects,;--------------------------------; define includes!include "WinMessages.nsh"!include "FileFunc.nsh"!include "LogicLib.nsh"; The version of the installer!define VERSION "1.2.1"; The name of the installerName "Sample ${VERSION}"; The file to writeOutFile "Sample.${VERSION}.exe"; The default installation directoryInstallDir "$PROGRAMFILES\Sample"; define reserved filesReserveFile "Sample.exe"ReserveFile "Sample.dll"ReserveFile "Sample.sys"ReserveFile "Sample.txt"; Registry key to check for directory (so if you install again, it will; overwrite the old one automatically)InstallDirRegKey HKLM "Software\Sample" "C:\Program Files\Sample\"; Request application privileges for Windows VistaRequestExecutionLevel admin; Define Interval variableVar /GLOBAL DefaultInterval;--------------------------------; Pages; describe licensePageEx licenseLicenseData license.txtPageExEndPage componentsPage instfilesUninstPage uninstConfirmUninstPage instfiles;--------------------------------; FunctionsFunction .onInitFunctionEndFunction .onInstSuccessFunctionEndFunction un.onInitFunctionEndFunction un.onUninstSuccessFunctionEnd;--------------------------------; The stuff to installSection "Sample ${VERSION}"SectionIn RO; Set output path to the installation directory.SetOutPath $INSTDIR; Write the installation path into the registryWriteRegStr HKLM SOFTWARE\Sample "Install_Dir" "$INSTDIR"; Write the uninstall keys for WindowsWriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Sample" "DisplayName" "Sample"WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Sample" "Publisher" "Sample Co., Ltd."WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Sample" "UninstallString" '"$INSTDIR\uninstall.exe"'WriteUninstaller "uninstall.exe"; Copy Sample.sysSetOutPath "C:\WINDOWS\system32\drivers\"File Sample.sys; Copy Sample files;SetOutPath "C:\Program Files\Sample\"SetOutPath $INSTDIRFile Sample.exeFile Sample.dllFile Sample.txtSectionEnd; Optional section (can be disabled by the user)Section "Start Menu Shortcuts"CreateDirectory "$SMPROGRAMS\Sample"CreateShortCut "$SMPROGRAMS\Sample\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0SectionEnd;--------------------------------; UninstallerSection "Uninstall"; Stop and remove ServicesExecWait '"Cmd.exe" /c net stop Sample'ExecWait '"Cmd.exe" /c $INSTDIR\Sample.exe -remove'; Remove registry keysDeleteRegKey HKLM "SYSTEM\CurrentControlSet\Services\Sample"DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Sample"DeleteRegKey HKLM "SYSTEM\CurrentControlSet\Services\Sample"DeleteRegKey HKLM "Software\Sample"; Remove files and uninstallerDelete "$INSTDIR\Sample.nsi"Delete "$INSTDIR\uninstall.exe"Delete "$INSTDIR\*.*"Delete "C:\windows\system32\drivers\Sample.sys"; Remove shortcuts, if anyDelete "$SMPROGRAMS\Sample\*.*"; Remove directories usedRMDir "$SMPROGRAMS\Sample"RMDir "$INSTDIR"SectionEnd
댓글 없음:
댓글 쓰기