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