基于inno setup的windos打包,主要脚本语言inno script。下载地址:https://jrsoftware.org/isdl.php
相关打包教程:https://blog.csdn.net/g710710/article/details/7217424
石材在windows下打包脚本:

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "xxxx"
#define MyAppVersion "3.2.4005"
#define MyAppPublisher "xxxx(xxxx IT Group)"
#define MyAppURL "https://www.dq.cn/"
#define MyAppExeName "dqstone.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={{C3804F8E-F0DA-4609-9898-437046B06637}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\XXXXITGroup\dqstone
DefaultGroupName={#MyAppName}
; The [Icons] "XXXXX" entry uses {userappdata} but its [Tasks] entry has a proper IsAdminInstallMode Check.
UsedUserAreasWarning=no
InfoBeforeFile=C:\XXX\xxxx使用协议20210207(SUBOYANG).rtf
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog
OutputDir=C:\StoneV2
OutputBaseFilename= "{#MyAppName}V({#MyAppVersion})"
SetupIconFile=C:\windows\code.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern
//设置控制面板中程序图标
UninstallDisplayIcon=C:\windows\code.ico //设置控制面板中程序的名称
Uninstallable=yes
UninstallDisplayName={#MyAppName} [Languages]
Name: "ChineseSimple"; MessagesFile: "compiler:Default.isl"
Name: "English"; MessagesFile: "compiler:Languages\English.isl" [Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone; OnlyBelowVersion: 6.1; Check: not IsAdminInstallMode [Files]
Source: "C:\App\XXX-win32-x64\XXX.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\App\XXX-win32-x64\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon [Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent [Code] // 自定义函数,判断软件是否运行,参数为需要判断的软件的exe名称
function KDetectSoft(strExeName: String): Boolean;
// 变量定义
var ErrorCode: Integer;
var bRes: Boolean;
var strFileContent: AnsiString;
var strTmpPath: String; // 临时目录
var strTmpFile: String; // 临时文件,保存查找软件数据结果
var strCmdFind: String; // 查找软件命令
var strCmdKill: String; // 终止软件命令
begin
strTmpPath := GetTempDir();
strTmpFile := Format('%sfindSoftRes.txt', [strTmpPath]);
strCmdFind := Format('/c tasklist /nh|find /c /i "%s" > "%s"', [strExeName, strTmpFile]);
strCmdKill := Format('/c taskkill /f /t /im %s', [strExeName]);
bRes := ShellExec('open', ExpandConstant('{cmd}'), strCmdFind, '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
if bRes then begin
bRes := LoadStringFromFile(strTmpFile, strFileContent);
strFileContent := Trim(strFileContent);
if bRes then begin
if StrToInt(strFileContent) > 0 then begin
if MsgBox(ExpandConstant('卸载程序检测到"{#MyAppName}"正在运行!点击"确定"终止软件后继续操作'), mbConfirmation, MB_OKCANCEL) = IDOK then begin
// 终止程序
ShellExec('open', ExpandConstant('{cmd}'), strCmdKill, '', SW_HIDE, ewNoWait, ErrorCode);
Result:= true;// 继续安装
end else begin
Result:= false;// 安装程序退出
Exit;
end;
end else begin
//MsgBox('软件没在运行', mbInformation, MB_OK);
Result:= true;
Exit;
end;
end;
end;
Result :=true;
end;
// 开始页下一步时判断软件是否运行
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if 1=CurPageID then begin
Result := KDetectSoft('XXXX.exe');
Exit;
end;
Result:= true;
end; // 卸载时关闭软件
function InitializeUninstall(): Boolean;
begin
Result := KDetectSoft('XXXXX.exe');
end;

code区代码编写主要用于卸载关闭软件代码编写

// 自定义函数,判断软件是否运行,参数为需要判断的软件的exe名称
function KDetectSoft(strExeName: String): Boolean;
// 变量定义
var ErrorCode: Integer;
var bRes: Boolean;
var strFileContent: AnsiString;
var strTmpPath: String; // 临时目录
var strTmpFile: String; // 临时文件,保存查找软件数据结果
var strCmdFind: String; // 查找软件命令
var strCmdKill: String; // 终止软件命令
begin
strTmpPath := GetTempDir();
strTmpFile := Format('%sfindSoftRes.txt', [strTmpPath]);
strCmdFind := Format('/c tasklist /nh|find /c /i "%s" > "%s"', [strExeName, strTmpFile]);
strCmdKill := Format('/c taskkill /f /t /im %s', [strExeName]);
bRes := ShellExec('open', ExpandConstant('{cmd}'), strCmdFind, '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
if bRes then begin
bRes := LoadStringFromFile(strTmpFile, strFileContent);
strFileContent := Trim(strFileContent);
if bRes then begin
if StrToInt(strFileContent) > 0 then begin
if MsgBox(ExpandConstant('卸载程序检测到"{#MyAppName}"正在运行!点击"确定"终止软件后继续操作'), mbConfirmation, MB_OKCANCEL) = IDOK then begin
// 终止程序
ShellExec('open', ExpandConstant('{cmd}'), strCmdKill, '', SW_HIDE, ewNoWait, ErrorCode);
Result:= true;// 继续安装
end else begin
Result:= false;// 安装程序退出
Exit;
end;
end else begin
//MsgBox('软件没在运行', mbInformation, MB_OK);
Result:= true;
Exit;
end;
end;
end;
Result :=true;
end;
// 开始页下一步时判断软件是否运行
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if 1=CurPageID then begin
Result := KDetectSoft('XXX.exe');
Exit;
end;
Result:= true;
end; // 卸载时关闭软件
function InitializeUninstall(): Boolean;
begin
Result := KDetectSoft('XXXX.exe');
end;

最新文章

  1. python排序之一插入排序
  2. Linux服务管理
  3. E - The Values You Can Make
  4. sqlserver集合操作
  5. [.NET 即时通信SignalR] 认识SignalR (一)
  6. OpenJudge/Poj 1631 Bridging signals
  7. SQL Server GOTO使用实例详解
  8. wpf 中DataGrid 控件的样式设置及使用
  9. mmap。
  10. 关于MATLAB处理大数据坐标文件2017529
  11. chrome开发工具指南(四)
  12. [Err] 1136 - Column count doesn't match value count at row 1
  13. JMX的l理解
  14. 一篇入门 — Gatling 性能测试手册
  15. WINDOWS系统中常用网络命令及命令实例详解
  16. 1823: [JSOI2010]满汉全席 2-sat
  17. [转]lua数据结构--闭包
  18. log下一次改版优化别人代码的事
  19. vue实战之狗血事件:页面loading效果诡异之事
  20. Spring 学习记录3 ConversionService

热门文章

  1. mysql5.7安装要踩的坑
  2. DAST 黑盒漏洞扫描器 第五篇:漏洞扫描引擎与服务能力
  3. NC20806 区区区间间间
  4. 【Azure Developer】记录一次使用Java Azure Key Vault Secret示例代码生成的Jar包,单独运行出现 no main manifest attribute, in target/demo-1.0-SNAPSHOT.jar 错误消息
  5. GRAPH CONVOLUTIONAL NETWORK WITH SEQUENTIAL ATTENTION FOR GOAL-ORIENTED DIALOGUE SYSTEMS
  6. 字节输入流_InputStream类&FileInputStream类介绍和字节输入流读取字节数据
  7. 意想不到的Python ttkbootstrap 制作账户注册信息界面
  8. MySQL原理
  9. Vue 路由懒加载, VueRouter一步完成Vue的路由懒加载 一行代码搞定懒加载
  10. ansible概述、安装、模块介绍