Common NSIS code set

Source: Internet
Author: User

The Helper's house editor has compiled some common NSIS code for you today, so you may be able to use it later ~

Get the operating system drive letter

ReadEnvStr $ R0 SYSTEMDRIVE

Create a log folder

CreateDirectory "$ R0 \ log"

Recursively Delete log folders

RMDir/r "$ R0 \ log"

The Windows Shutdown dialog box is displayed.

FindWindow $0 "shell_traywnd"

SendMessage $0 273 506 0

Request Windows Help

FindWindow $0 "shell_traywnd"

SendMessage $0 273 503 0

Refresh screen in one sentence

System: Call 'shell32: SHChangeNotify (I 0x8000000, I 0, I 0, I 0 )'

Enable desktop Properties

3 In... cpl, 'can be changed

-1 Theme 0 wallpaper 1 screensaver 2 exterior 3 settings

Exec 'Rundll32.exe shell32.dll, Control_RunDLL Desk. cpl, '; open "Settings"

Obtain the directory of the installer

System: Call 'kernel32: GetCurrentDirectory (I 1024, t. R1 )'

MessageBox MB_ OK 'installation program Directory: $ r1'

Obtain the PID of the current installer Process

System: Call 'kernel32: GetCurrentProcessId () I. R0'

MessageBox MB_ OK 'installer process PID: $ R0'

Obtain the disk volume tag

StrCpy $ R0 "C :\"

System: Call 'kernel32: GetVolumeInformationA (t R0, t. R1, I 100, I. R3, I. R4, I. R5, t. R6, I 100 )'

MessageBox MB_ OK 'Drive letter: $ R0 $ \ n volume label: $ R1 $ \ n File Format: $ r6'

Set file Properties

StrCpy $ R0 "C: \ 1.EXE"; File

StrCpy $ R1 0x20; Attribute

System: Call 'kernel32: SetFileAttributesA (t R0, I 0x100 )'

; Attribute Table

; 0x20 FILE_ATTRIBUTE_ARCHIVE, archive

; 0x2 FILE_ATTRIBUTE_HIDDEN, hide

; 0x80 FILE_ATTRIBUTE_NORMAL, normal

0x2000 FILE_ATTRIBUTE_NOT_CONTENT_INDEXED, not indexed

; 0x1000 FILE_ATTRIBUTE_OFFLINE, offline

; 0x1 FILE_ATTRIBUTE_READONLY, read-only

; 0x4 FILE_ATTRIBUTE_SYSTEM, System

; 0x100 FILE_ATTRIBUTE_TEMPORARY,; temporary attribute (generally invalid)

Add an icon link to the Windows 7 system taskbar.

SetOutPath $ WINDIR

CreateShortcut "$ DESKTOP \ notepad. lnk" "$ WINDIR \ notepad.exe"

ExecShell taskbarpin "$ DESKTOP \ notepad. lnk"

Specifies the execution level required for the installation program under WIN7.

RequestExecutionLevel admin

NSIS integrated enhanced version latest green version

Http://www.6686.com/soft/16213.html

I believe you will use it ~

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.