Summary of NSIs

Source: Internet
Author: User

Installation File preparation tool NSIs usage summary when developing client software for the customer, to avoid additional cost loss caused by the installation by technicians on-site, we usually make an installation package by ourselves, to ensure that the related resource and environment of the program we developed can be automatically and correctly configured before the client runs. NSIs is a popular tool for creating installation files. It is easy to create and provides a scripting language to define static resource configurations for the environment and program, so that the installation files can be customized, it can automatically generate executable installation packages based on custom script files, greatly simplifying the release of programmers. NSIs provides multiple script demos, which can be directly opened on the UI to view and learn their demos. The script commands are basically used to set the components of the installer: installer title, default installation directory, file to be copied, target address and directory structure, Runtime Environment Settings: Registry, operation during uninstallation: delete the file, registry. Therefore, the corresponding Script Commands include the following types: 1. installer title: name2. default installation directory: installdir3. file to be copied: file4. target address and directory structure: installdir 5. run Environment Settings: Registry, shortcut: writeregstr, createshortcut6. operations during uninstallation: delete files, directories, Registry: delete, rmdir, deleteregkey Note: 1. if the program needs to be installed on the C drive, you need to obtain the admin permission in the later versions of win Vista. 2. To add a directory under the target address, you must set a new output directory after creating the directory. Createdirectory $ instdir \ mplayer
The following is an example of the setoutpath $ instdir \ mplayer script code:; VRA. NSI
;
; This script is based on VRA. NSI, But it remember the directory,
; Has uninstall support and (optionally) installstart menu shortcuts.
;
; It will install VRA. NSI into a directory that the user selects,

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

; The name of the installer
Name "VRA installer"
Installdir "C: \ VRA"

; The file to write
; OUTFILE "example2.exe"
OUTFILE "vra_installer.exe"
Requestexecutionlevel Admin


; The default installation directory
; Installdir $ ProgramFiles \ VRA

; Registry key to check for directory (so if you install again, it will
; Overwrite the old one automatically)
Installdirregkey HKLM "SOFTWARE \ VRA" "install_dir"

; Request application privileges for Windows Vista
Requestexecutionlevel Admin

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

; Pages

Page Components
Page Directory
Page instfiles

Uninstpage uninstconfirm
Uninstpage instfiles

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

; The stuff to install
Section "VRA (required )"

Sectionin Ro

; Set output path to the installation directory.
Setoutpath $ instdir

; Put file there
; File "example2.nsi"
File "bz2.pyd"
File "msvcp90.dll"
File "msvcr90.dll"
File "msvcrt. dll"
File "pycpuid. _ pycpuid. PYD"
File "python27.dll"
File "pywintypes27.dll"
File "screen_left.bmp"
File "Select. PYD"
File "unicodedata. PYD"
File "user32.dll"
File "vra.exe"
File "vra.exe. manifest"
File "WIN32API. PYD"
File "win32evtlog. PYD"
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
File "wxmsw30u_html_vc90.dll"
File "_ ctypes. PYD"
File "_ hashlib. PYD"
File "_ socket. PYD"
File "_ SSL. PYD"
File "mplayer.exe"
Createdirectory $ instdir \ mplayer
Setoutpath $ instdir \ mplayer
File "mplayer \ config"
Setoutpath $ instdir

; Write the installation path into the registry
Writeregstr hklm software \ VRA "install_dir" "$ instdir"
Writeregstr hkcu "SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Run" shell "$ instdir \ vra.exe"

; Write the uninstall keys for Windows
Writeregstr HKLM "SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall \ VRA" "VRA" "VRA"
Writeregstr HKLM "SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall \ VRA" "uninstall_vra" '"$ instdir \ uninstall.exe "'
Writeregdword HKLM "SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall \ VRA" "nomodify" 1
Writeregdword HKLM "SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall \ VRA" "norepair" 1
Writeuninstaller "uninstall.exe"

Sectionend

; Optional section (can be disabled by the user)
Section "Start Menu shortcuts"

Createdirectory "$ smprograms \ VRA"
Createshortcut "$ smprograms \ VRA \ Uninstall. lnk" "$ instdir \ uninstall.exe" $ instdir \ uninstall.exe "0
Createshortcut "$ smprograms \ VRA. lnk" "$ instdir \ vra.exe" $ instdir \ vra.exe "0

Sectionend



; Optional section (can be disabled by the user)
Section "Desktop shortcuts" sectionx

Setshellvarcontext current
Createshortcut "$ Desktop \ VRA. lnk" "$ instdir \ vra.exe"
; Writeregstr HKLM "SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ appcompatflags \ Layers" "$ instdir \ vra.exe" "runasadmin"
Sectionend


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

; Uninstaller

Section "Uninstall"

; Remove registry keys
Deleteregkey HKLM "SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall \ VRA"
Deleteregkey hklm software \ VRA

; Remove files and uninstaller
; Delete $ instdir \ example2.nsi
; Delete $ instdir \ uninstall.exe
Delete "$ instdir \ bz2.pyd"
Delete "$ instdir \ microsoft. vc90.crt. manifest"
Delete "$ instdir \ msvcm90.dll"
Delete "$ instdir \ msvcp90.dll"
Delete "$ instdir \ msvcr90.dll"
Delete "$ instdir \ msvcrt. dll"
Delete "$ instdir \ pycpuid. _ pycpuid. PYD"
Delete "$ instdir \ python27.dll"
Delete "$ instdir \ pywintypes27.dll"
Delete "$ instdir \ screen_left.bmp"
Delete "$ instdir \ select. PYD"
Delete "$ instdir \ unicodedata. PYD"
Delete "$ instdir \ user32.dll"
Delete "$ instdir \ vra.exe"
Delete "$ instdir \ vra.exe. manifest"
Delete "$ instdir \ WIN32API. PYD"
Delete "$ instdir \ win32evtlog. PYD"
Delete "$ instdir \ wx. _ controls _. PYD"
Delete "$ instdir \ wx. _ core _. PYD"
Delete "$ instdir \ wx. _ GDI _. PYD"
Delete "$ instdir \ wx. _ MISC _. PYD"
Delete "$ instdir \ wx. _ WINDOWS _. PYD"
Delete "$ instdir \ wxbase30u_net_vc90.dll"
Delete "$ instdir \ wxbase30u_vc90.dll"
Delete "$ instdir \ wxmsw30u_adv_vc90.dll"
Delete "$ instdir \ wxmsw30u_core_vc90.dll"
Delete "$ instdir \ wxmsw30u_html_vc90.dll"
Delete "$ instdir \ _ ctypes. PYD"
Delete "$ instdir \ _ hashlib. PYD"
Delete "$ instdir \ _ socket. PYD"
Delete "$ instdir \ _ SSL. PYD"
Delete "$ instdir \ mplayer.exe"
Delete "$ instdir \ mplayer \ config"
Delete "init. Check"
Delete "init. Video"
Delete "kamhearing. log"
Delete "player_reg.dll"
Delete "uninstall.exe"

; Remove shortcuts, if any
Delete "$ smprograms \ VRA \*.*"
Delete "$ smprograms \ VRA. lnk"

; Remove directories used
Rmdir "$ smprograms \ VRA"
Rmdir "$ instdir \ mplayer"
Rmdir "$ instdir"


Sectionend

Summary of NSIs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.