inno setup 安装 .net 服务

本文介绍了一个使用InnoSetup创建安装程序的例子。脚本定义了应用名称、版本及发布者等基本信息,并设置了安装路径、许可协议文件及压缩方式。此外,还包含了用于注册和卸载Windows服务的批处理文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

inno setup 脚本

#define MyAppName "getService"
#define MyAppVersion "1.0"
#define MyAppPublisher "AZ Studio"
#define MyAppURL "http://sou.niceant.com"
#define MyAppExeName "getService.exe"

[Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (生成新的GUID,点击 工具|在IDE中生成GUID。)
AppId={{4138D01D-3AC5-4180-9E7E-96FEB59CE393}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
LicenseFile=E:\iDev\getBT\getBT\setup\publish\innosetup\program\license.txt
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes

[Languages]
Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"

[Files]
;Source: "E:\iDev\getBT\getBT\setup\publish\innosetup\program\getService.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "E:\iDev\getBT\getBT\setup\publish\innosetup\program\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"

[Run]
Filename: "{app}\installService.bat"; Description: "注册服务";Flags:runhidden

[UninstallRun]
Filename: "{app}\unstallService.bat";Flags:runhidden 

installService.bat

sc create "getService" binPath= "%~dp0getService.exe" start= auto
net start "getService"

unstallService.bat

net stop "getService"
sc delete "getService"

已在xp,win7下测试通过。

ikmb@163.com


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值