innosetup 打包

1、shellexec

ShellExec('open','taskkill.exe','/f /im {#MyAppExeName}','',SW_HIDE,ewNoWait,ErrorCode); ShellExec('open','tskkill.exe',' {#MyAppName}','',SW_HIDE,ewNoWait,ErrorCode);

2、cmd

[UninstallRun]
Filename: "{cmd}"; Parameters: "/C ""taskkill /im MustsWatcher.exe /f /t"
Filename: "{cmd}"; Parameters: "/C ""taskkill /im MUSTSYS.exe /f /t"

3、注册表

[Registry]
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "mustsWin"; ValueData: "{app}\Watcher\MustsWatcher.exe"

例子:

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "JOS"
#define MyAppVersion "1.0.0.8"
#define MyAppExeName "MUSTSYS.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{E5025D4B-4E2F-4101-8BC6-392756C41AC0}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
DefaultDirName=C:\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputDir=C:\Users\lys\Desktop
OutputBaseFilename=mustc
Compression=lzma
SolidCompression=yes
UsePreviousAppDir=no 
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "C:\JOS\bin\MUSTSYS.exe"; DestDir: "{app}\bin"; Flags: ignoreversion
Source: "C:\JOS\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[code]
//删除所有配置文件以达到干净卸载的目的
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);

begin
          
if CurUninstallStep = usUninstall then

if MsgBox('您是否要删除用户配置信息?', mbConfirmation, MB_YESNO) = IDYES then

//删除 {app} 文件夹及其中所有文件
DelTree(ExpandConstant('{app}'), True, True, True);
end;

[Registry]
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "mustsWin"; ValueData: "{app}\Watcher\MustsWatcher.exe"

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\bin\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{group}\启动保活程序"; Filename: "{app}\启动保活程序.bat"
Name: "{group}\停止保活程序"; Filename: "{app}\停止保活程序.bat"
Name: "{commondesktop}\musts"; Filename: "{app}\bin\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\Watcher\MustsWatcher.exe";Flags: nowait postinstall skipifsilent
Filename: "{app}\bin\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[UninstallRun]
Filename: "{cmd}"; Parameters: "/C ""taskkill /im MustsWatcher.exe /f /t"
Filename: "{cmd}"; Parameters: "/C ""taskkill /im MUSTSYS.exe /f /t"

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值