![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
inno Setup; 脚本用 Inno Setup 脚本向导 生成。
; 查阅文档获取创建 INNO SETUP 脚本文件的详细资料!
#define MyAppName "商务标客户端工具"
#define MyAppVerName "商务标客户端工具1.1.7"
#define MyAppVer "1.1.7"
#define MyAppPublisher "xxxxx有限公司"
#define MyAppURL "http://www.smartaudit.com.cn/"
#define MyAppExeName "bjqd.exe"
;安装新版本时删除旧版本
[Code]
procedure InitializeWizard();
var
ResultStr: String;
ResultCode: Integer;
begin
{查找软件安装信息,看是否安装过次软件}
if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{24965BF4-BCCE-4776-A7EF-B9F758003242}_is1', 'UninstallString', ResultStr) then
if MsgBox('您曾安装过本软件,即将卸载旧版本!', mbInformation, MB_YESNO) =IDYES then
begin
ResultStr := RemoveQuotes(ResultStr);
Exec(ResultStr, '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
end;
end;
//检测系统是否支持msxml6,不支持则安装msxml6_86.msi
procedure deinitializeSetup();
var
ResultCode: Integer;
begin
//检测安装系统是否安装了msxml6,没有则运行安装包msxml6_x86.msi
if not FileExists(ExpandConstant('{sys}\msxml6.dll')) then
ShellExec('open', ExpandConstant('{%TEMP}\msxml6_x86.msi'), '', '', SW_SHOW, ewNoWait, ResultCode);
end;
[Setup]
; 注意: AppId 的值是唯一识别这个程序的标志。
; 不要在其他程序中使用相同的 AppId 值。
; (在编译器中点击菜单“工具 -> 产生 GUID”可以产生一个新的 GUID)
AppId={{24965BF4-BCCE-4776-A7EF-B9F758003242}
AppName={#MyAppName}
AppVerName={#MyAppVerName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
;DefaultDirName={pf}\{#MyAppName}
DefaultDirName={reg:HKLM\Software\Microsoft\windows\CurrentVersion\Uninstall\商务标客户端工具_is1,Inno Setup: App Path|{pf}\商务标客户端工具}
DefaultGroupName={#MyAppName}
;显示更新信息
;InfoBeforeFile=.\bin\what's new.txt
OutputBaseFilename=setup_swbkhd
VersionInfoCompany="xxxx有限公司"
VersionInfoDescription="商务标客户端工具"
VersionInfoVersion={#MyAppVer}
Compression=lzma
SolidCompression=yes
AppMutex="商务标客户端工具"
ChangesAssociations=yes
[Languages]
Name: "default"; MessagesFile: "compiler:Default.isl"
[Tasks]
;桌面快捷方式
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
;快速启动
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
;安装的源文件在安装脚本的同级目录下的"商务标客户端工具"中,主程序为WebBadge
Source: ".\bin\bjqd.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: ".\bin\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\msxml6.0\msxml6_x86.msi"; DestDir: "{%TEMP}"; Flags: ignoreversion
; 注意: 不要在任何共享的系统文件使用 "Flags: ignoreversion"
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
[Registry]
;注册文件类型
Root: HKCR; Subkey: ".tbsj"; ValueType: string; ValueName: ""; ValueData: "投标数据.tbsj"
;注册文件类型描述
Root: HKCR; Subkey: "投标数据.tbsj"; ValueType: string; ValueName: ""; ValueData: "投标数据文件"
;注册文件图标
Root: HKCR; Subkey: "投标数据.tbsj\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0"
;资源管理器中打开文件
Root: HKCR; Subkey: "投标数据.tbsj\Shell\Open"; ValueType: string; ValueName: ""; ValueData: "&Open"
;文件和自定义程序关联
Root: HKCR; Subkey: "投标数据.tbsj\Shell\Open\Command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1"""
;注册文件类型
Root: HKCR; Subkey: ".zbsj"; ValueType: string; ValueName: ""; ValueData: "招标数据.zbsj"
;注册文件类型描述
Root: HKCR; Subkey: "招标数据.zbsj"; ValueType: string; ValueName: ""; ValueData: "招标数据文件"
;注册文件图标
Root: HKCR; Subkey: "招标数据.zbsj\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0"
;资源管理器中打开文件
Root: HKCR; Subkey: "招标数据.zbsj\Shell\Open"; ValueType: string; ValueName: ""; ValueData: "&Open"
;文件和自定义程序关联
Root: HKCR; Subkey: "招标数据.zbsj\Shell\Open\Command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1"""
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, "&", "&&")}}"; Flags: nowait postinstall skipifsilent
;Filename: "{sys}\regsvr32.exe"; Parameters: "/s xxx.ocx"
[UninstallDelete]
Type: filesandordirs ; Name: "{app}"