1.关联文件图标设置方法:“.xxx”为关联文件后缀
#define MyAppAssocExt ".xxx"
[Registry]
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "F:\Test\test.ico,0"
#define MyAppAssocExt ".xxx"
定义了文件扩展名为.xxx
,这是将要进行关联的文件扩展名。[Registry]
标记表示下面的条目将用于注册表操作。Root: HKA
指定了注册表项的根键为HKEY_CLASSES_ROOT
。Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"
指定了要在其中添加注册表项的路径。{#MyAppAssocKey}
是用于指定文件扩展名关联的键。ValueType: string
指定了注册表值的类型为字符串。ValueName: ""
指定了注册表值的名称为空,表示这是默认图标。ValueData: "F:\Test\test.ico,0"
将图标文件的路径(F:\Test\test.ico
)和图标索引号(0
)关联到指定文件扩展名的文件类型上。
2.将当前程序的安装路径添加到系统的环境变量 PATH
中,可以cmd输入程序名直接运行:ValueName要为“path”,否则无效
[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; ValueName: "path"; ValueData: "{app}"; Flags: uninsdeletevalue
Root: HKLM
指定了注册表项的根键为HKEY_LOCAL_MACHINE
。Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
指定了要在其中添加注册表项的路径,这是 Windows 系统环境变量的位置。ValueType: string
指定了注册表值的类型为字符串。ValueName: "Path"
指定了注册表值的名称为Path
,这是系统环境变量的名称。ValueData: "{app}"
将当前程序的安装路径添加到Path
环境变量中。{app}
是 Inno Setup 脚本中的一个特殊变量,代表当前程序的安装路径。Flags: uninsdeletevalue
指定了在卸载时删除该注册表值。