修改.iss配置文件即可
1.设置开机启动
在对应模块中加入代码,在安装时候默认勾选开机启动了
[Tasks]
Name: "startupicon"; Description: "开机启动"; GroupDescription: "{cm:AdditionalIcons}";
[Icons]
Name: "{commonstartup}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: startupicon
[Registry]
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";ValueType: string; ValueName: "testrun";ValueData: "{app}\{#MyAppExeName}"
2.把uninstall卸载功能 改为 ‘卸载.exe’
在对应模块中加入代码,注意在 [UninstallRun] 要杀死已经启动程序后,才能卸载哦
如果本机有多个java程序可以吧 jdk/bin/java.exe 可以改为 其他名称比如 javaNew.exe,然后就杀死 javaNew.exe好了。最后要停止mysql服务
[UninstallRun]
Filename: "cmd.exe"; Parameters: "/C taskkill /F /IM java.exe"; Flags: runhidden
Filename: "cmd.exe"; Parameters: "/C sc stop mysql"; Flags: runhidden
Filename: "cmd.exe"; Parameters: "/C sc delete mysql force"; Flags: runhidden
Filename: "cmd.exe"; Parameters: "/C taskkill /IM 启动.exe /F"; Flags: runhidden[UninstallDelete]
Type: filesandordirs; Name: "{app}"[CODE]
procedure CurStepChanged(CurStep: TSetupStep);
var
uninspath, uninsname, NewUninsName, MyAppName: string;
begin
if CurStep=ssDone then
begin
// 指定新的卸载文件名(不包含扩展名),请相应修改!
NewUninsName := '卸载';
// 应用程序名称,与 [SEUTP] 段的 AppName 必须一致,请相应修改!
MyAppName := 'myPro';
// 以下重命名卸载文件
uninspath:= ExtractFilePath(ExpandConstant('{uninstallexe}'));
uninsname:= Copy(ExtractFileName(ExpandConstant('{uninstallexe}')),1,8);
RenameFile(uninspath + uninsname + '.exe', uninspath + NewUninsName + '.exe');
RenameFile(uninspath + uninsname + '.dat', uninspath + NewUninsName + '.dat');
// 以下修改相应的注册表内容
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + MyAppName + '_is1') then
begin
RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + MyAppName + '_is1', 'UninstallString', '"' + uninspath + NewUninsName + '.exe"');
RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + MyAppName + '_is1', 'QuietUninstallString', '"' + uninspath + NewUninsName + '.exe" /SILENT');
end;
end;
end;
3.再次安装时候 重新选择其他目录(取消默认安装目录)
在对应模块中加入代码,
[Setup]
UsePreviousAppDir=no