Inno Setup operation registry

Some programs need to be started with the system, or some file associations need to be established. These are the results of operating the registry in the installer. In Inno Setup , the operation of the registry is realized through the [registry] section.

This paragraph states:

parameter list:

parameter

illustrate

Root

root key. Must be one of the following :

HKCR (HKEY_CLASSES_ROOT)

HKCU (HKEY_CURRENT_USER)

HKLM (HKEY_LOCAL_MACHINE)

HKU (HKEY_USERS)

HKCC (HKEY_CURRENT_CONFIG)

Subkey

subkey name, can contain constants

ValueType

Value type, must be one of the following :

none

string

expandsz

multisz

dword

binary

If none  is specified (the default), the installer will create a key with no key value, in which case the ValueName  and ValueData  parameters will be ignored.

ValueName

The name of the value to create, can contain constants, if blank it will be written to the "default" value

ValueData

value data

Permissions

Specifies additional permissions for the login registry key ACL ( Access Control List , this parameter is only valid in Windows 2000  or later, the available parameters are full , modify and read

Flags

is an extra option setting. Multiple options can be separated by spaces. The following options are supported:

createvalueifdoesntexist

deletekey

deletevalue

dontcreatekey

noerror

preservestringtype

uninsclearvalue

uninsdeletekey

uninsdeletekeyifempty

uninsdeletevalue

The following example will cause the installer to run automatically after the operating system starts.

[setup]

; Global settings, this section must

AppName=Test

AppVerName=TEST

DefaultDirName="E:\TEST"

AppVersion=1.0

Compression=lzma2/max

ShowLanguageDialog=yes

 

[components]

Name: main; Description: " Main program ( required )";Types:full compact custom;Flags: fixed

Name: data; Description:" data file ";Types:full

Name: help;Description:" Help file ";Types:full compact

 

[files]

Source: "F:\desktop\test\ipmsg.exe"; DestDir: "{app}";Components:main

Source: "F:\desktop\test\bin.dat"; DestDir: "{app}";Components:data

Source: "F:\desktop\test\help.chm"; DestDir: "{app}" ;Components:help

Source: "F:\desktop\test\readme.txt"; DestDir: "{app}";components:help;Flags:isreadme

 

[registry]

;本段处理程序在注册表中的键值

Root:HKLM;Subkey:SOFTWARE\Microsoft\Windows\CurrentVersion\Run;ValueType: string; ValueName:TEST;ValueData:{app}\ipmsg.exe;Flags: uninsdeletevalue

一路Next到底,安装完成后可以检查注册表:

Inno Setup入门(十)——操作注册表 - Castor - 趁年轻,多折腾~~

 确实添加到注册表中去了,通过金山卫士也证实了这一点:

Inno Setup入门(十)——操作注册表 - Castor - 趁年轻,多折腾~~

 

    由于使用的标志位是uninsdeletevalue,所以卸载软件将会自动删除该值,如果使用uninsdeletekey的话,该键下的其他值都会被删除,这不是一个很好的方法,除非你确定使用的是自己的专用键,否则不推荐使用。

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326570687&siteId=291194637