inno setup 安裝 .net 服務

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下測試通過。

[email protected]


發佈了328 篇原創文章 · 獲贊 9 · 訪問量 89萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章