This article Reprinted from: http://blog.csdn.net/yushanddddfenghailin/article/details/17250871
Some programs need to be started with the system, or some file associations need to be established. These are the results of registry operations in the installation program. In Inno Setup, you can use the [registry] Section to perform registry operations.
Description:
Parameter List:
Parameters |
Description |
Root |
Root Key. It 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 |
Sub-key name, which can contain Constants |
Valuetype |
Value type, which must be one of the following: None String Expandsz Multisz DWORD Binary If none is specified (the default setting), the installer creates a key without a key value. In this case, the valuename and valuedata parameters are ignored. |
Valuename |
The name of the value to be created, which can contain constants. If it is blank, it is written to the "default" value. |
Valuedata |
Value Data |
Permissions |
Specify the additional permissions for logging on to the registry key ACL (Access Control List). This parameter is only valid in Windows 2000 or later versions. The available parameters are full, modify, and read. |
Flags |
Is an additional option. 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 make the installer run automatically after the operating system is started.
[Setup] ; Global settings, this section is required Appname = test Appvername = test Defaultdirname = "E: \ test" Appversion = 1.0 Compression = lzma2/MAX Showemediagedialog = 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] ; The key value of the current handler in the Registry Root: HKLM; subkey: Software \ Microsoft \ Windows \ CurrentVersion \ Run; valuetype: string; valuename: Test; valuedata: {app} \ ipmsg.exe; flags: uninsdeletevalue |
After the installation is complete, you can check the registry:
It was added to the Registry and confirmed by Kingsoft GUARD:
Because the flag used is uninsdeletevalue, uninstalling the software will automatically delete this value. If uninsdeletekey is used, other values under this key will be deleted. This is not a good method, unless you are sure to use your own private key, it is not recommended.