一、仔细看看官方帮助文档 [ICON] 段 吧,很详细。
[Icons]
//添加到开始菜单
Name: "{group}\你想要的中文名"; Filename: "{app}\MYPROG.EXE"; WorkingDir: "{app}"
Name: "{group}\Uninstall My Program"; Filename: "{uninstallexe}"
//添加到桌面
Name: "{commondesktop}\你想要的中文名"; Filename: "{app}\MYPROG.EXE"; WorkingDir: "{app}"
//{app}\MYPROG.EXE 就是你安装目录下的可执行程序。{app} 是安装目录常量
比如你还要添加安装目录下 Autoplay 文件夹下的 Menu Builder.exe 程序到开始菜单程序组:
Name: "{group}\Menu Builder 中文版"; Filename: "{app}\Autoplay\Menu Builder.exe"; WorkingDir: "{app}"
二、卸载时删除可以看下 [UninstallDelete] 段
如:
[UninstallDelete]
//删除安装目录下 app.ini 文件
Type: files; Name: "{app}\app.INI"
//删除安装目录下 appdir 文件夹及其所有文件
Type: filesandordirs; Name: "{app}\appdir"
/如果 test 是空文件夹,则删除
Type: dirifempty; Name: "{app}\appdir"
第二种方式,在 [CODE] 段删除文件 :
[code]
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
case CurUninstallStep of
usPostUninstall:
begin
if MsgBox('你是否想要删除 xx 文件(夹)?', mbConfirmation, MB_YESNO) = IDYES then
begin
//删除安装目录下 test 文件夹
DelTree(ExpandConstant('{app}\test'), true, true, true);
//删除安装目录下 test.exe 文件
DelFile(ExpandConstant('{app}\test.exe'), true, true, true);
end;
end;
end;
end;