提交 7980d5e2 authored 作者: wangqiang's avatar wangqiang

install service

上级 b1ce503b
package com.priusis.client.service;
import com.priusis.ApqClientApplication;
import com.priusis.client.service.conf.PcPersistenceConfiguration;
import com.sun.jna.Platform;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.PostConstruct;
......@@ -33,8 +35,32 @@ public class PersistentFileServiceImpl implements PersistentFileService {
}
private void initStorageDir() {
storageDir = new File(System.getProperty("user.home") + File.separator + ".haikang");
if (!storageDir.exists()) storageDir.mkdirs();
try {
String relatePath = File.separator + ".haikang";
String defaultPath = System.getProperty("user.home") + relatePath;
String path = defaultPath;
if (Platform.isWindows()) {
path = ApqClientApplication.class.getResource("/").getPath() + relatePath;
if (path.contains("BOOT-INF")) {
path = System.getProperty("user.dir") + relatePath;
}
path = path.replaceFirst("/", "");//排除中文空格
path = path.replaceAll("%20", " ");//排除中文空格
path = path.replaceAll("/", "\\\\");//排除中文空格
try {
path = java.net.URLDecoder.decode(path, "utf-8"); //解决路径包含中文的情况
log.info("解析到PATH为:{}", path);
} catch (Exception e) {
log.error("usr decode", e);
path = defaultPath;
}
}
storageDir = new File(path);
if (!storageDir.exists()) storageDir.mkdirs();
} catch (Exception e) {
log.error("初始化存储目录异常", e);
}
}
private void initBuffers() {
......
......@@ -180,7 +180,7 @@ public class ProgramController {
DOWNLOAD_PATH_MAP.put(key, file.getPath().replace('\\', '/'));
}
/*@GetMapping(value = "{type}/is_installing")
/* @GetMapping(value = "{type}/is_installing")
public R<Boolean> isInstalling(@PathVariable @Pattern(regexp = "install|upgrade") String type,
@RequestParam @NotNull Long id) {
return R.success(MAP.containsKey(type + "-" + id));
......
apq:
iot-gateway: 192.168.124.19:7002
PC_HOST: 192.168.124.6
vnc-repeater: 120.24.236.245:5500
#apq:
# iot-gateway: 192.168.6.23:7033
#PC_HOST: 192.168.6.23
......
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "阿普奇检测客户端"
#define MyAppVersion "V1.0"
#define MyAppName "阿普奇检测客户端"
#define MyAppVersion "V1.0"
#define MyAppPublisher "阿普奇"
#define MyAppURL "https://www.apq.com/"
#define MyAppDirName "apq-client"
#define MyAppEnName "apq-client"
#define MyAppExeName "apq-client.exe"
#define MyAppReBootName "service\启动服务R.bat"
[Setup]
; 注: AppId的值为单独标识该应用程序。
......@@ -17,7 +16,7 @@
; Tell Windows Explorer to reload the environment
ChangesEnvironment=yes
DisableDirPage=no
AlwaysRestart=yes
; AlwaysRestart=yes
AppId={{1394783A-5D3C-48CD-0000-E2DFBB844E42}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
......@@ -53,7 +52,7 @@ VersionInfoVersion=1.0.0.1
Name: "chinese"; MessagesFile: "compiler:Languages/Chinese.isl"
[Files]
Source: "../apq-client/*"; Excludes: "bak"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
Source: "../apq-client/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
Source: "../../java/jre/jre/*"; DestDir: "{app}/jre"; Flags: ignoreversion recursesubdirs createallsubdirs;
Source: "../../client/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
......@@ -78,7 +77,6 @@ Type: dirifempty; Name: "{app}"
;操作注册表
[Registry]
Root: HKLM; Subkey: "Software\{#MyAppEnName}"; Flags: uninsdeletekey;
Root: HKCU; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "{#MyAppEnName}"; ValueData: "{app}\{#MyAppReBootName}"; Flags: uninsdeletevalue;
[Code]
function CheckProcessRunning( aProcName,
......
......@@ -3,12 +3,12 @@
#define MyAppName "阿普奇检测客户端"
#define MyAppVersion "V1.0"
#define MyAppPublisher "阿普奇"
#define MyAppURL "https://www.apq.com/"
#define MyAppDirName "apq-client"
#define MyAppPublisher "阿普奇"
#define MyAppURL "https://www.apq.com/"
#define MyAppDirName "apq-client"
#define MyAppEnName "apq-client"
#define MyAppExeName "apq-client.exe"
#define MyAppReBootName "service\启动服务R.bat"
#define MyAppExeName "apq-client.exe"
#define MyAppReBootName "service\启动服务R.bat"
[Setup]
; 注: AppId的值为单独标识该应用程序。
......@@ -47,32 +47,32 @@ PrivilegesRequired=admin
UninstallDisplayIcon={app}/{#MyAppExeName}
//CreateUninstallRegKey=no
//UpdateUninstallLogAppName=no
VersionInfoVersion=1.0.0.1
VersionInfoVersion=1.0.0.1
[Languages]
Name: "chinese"; MessagesFile: "compiler:Languages/Chinese.isl"
[Files]
Source: "../apq-client/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
[Files]
Source: "../apq-client/*"; Excludes: "bak"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
Source: "../../java/jre/jre/*"; DestDir: "{app}/jre"; Flags: ignoreversion recursesubdirs createallsubdirs;
Source: "../../client/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
[Icons]
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\client-soft\apq.exe";
[Run]
Filename: "{app}\Set_Env.bat"; Flags: runhidden;
[Run]
Filename: "{app}\Set_Env.bat"; Flags: runhidden;
Filename: "{app}\service\启动服务.bat"; Flags: runhidden runascurrentuser waituntilterminated;
;卸载后执行的操作(停止、删除各种服务)
[UninstallRun]
[UninstallRun]
Filename: "{app}\service\删除服务.bat"; Flags: runhidden;
;卸载后删除目录所有文件,删除空目录
[UninstallDelete]
Type: filesandordirs; Name: "{app}\*"
Type: filesandordirs; Name: "{app}\*"
Type: dirifempty; Name: "{app}"
;操作注册表
......
cd /d "%~dp0"
@ECHO OFF
setlocal enabledelayedexpansion
for /F "TOKENS=1,2,*" %%b in ('tasklist /FI "IMAGENAME eq apq.exe"') do TASKKILL /F /PID %%b
taskkill -f -t -im %MyPID%
@ECHO Stopping apq-client-service ...
net stop apq-client-service
for /F "TOKENS=1,2,*" %%a in ('jps -m ^| findstr apq-pc-info') do set SPID=%%a
TASKKILL /F /PID %SPID%
@ECHO Uninstalling apq-client-service ...
"%~dp0apq-client-service.exe" uninstall
for /F "TOKENS=1,2,*" %%a in ('jps -m ^| findstr apq-pc-control') do set SPID=%%a
TASKKILL /F /PID %SPID%
@ECHO Stopping apq-other-service ...
net stop apq-control-service
net stop apq-info-service
net stop apq-register-service
for /F "TOKENS=1,2,*" %%a in ('jps -m ^| findstr apq-pc-register') do set SPID=%%a
TASKKILL /F /PID %SPID%
@ECHO Uninstalling apq-other-service ...
sc delete apq-control-service
sc delete apq-info-service
sc delete apq-register-service
for /F "TOKENS=1,2,*" %%a in ('jps -m ^| findstr apq-pc-client') do set SPID=%%a
TASKKILL /F /PID %SPID%
@ECHO DONE.
echo stop apq client service
exit
\ No newline at end of file
:END
\ No newline at end of file
cd /d "%~dp0"
::start xx.exe
setlocal enabledelayedexpansion
@ECHO OFF
for /F "TOKENS=1,2,*" %%b in ('tasklist /FI "IMAGENAME eq apq.exe"') do TASKKILL /F /PID %%b
::taskkill -f -t -im %MyPID%
setlocal ENABLEEXTENSIONS
for /F "TOKENS=1,2,*" %%a in ('jps -m ^| findstr apq-pc-client') do set SPID=%%a
TASKKILL /F /PID %SPID%
@ECHO Installing apq-client-service ...
"%~dp0apq-client-service.exe" install
@ECHO running apq-client-service ...
"%~dp0apq-client-service.exe" start
start ..\jre\bin\apq-client -Xms256m -Xmx256m -Dfile.encoding=utf-8 -jar "%~dp0\apq-pc-client-0.0.1-SNAPSHOT-boot.jar"
echo start apq client service
exit
\ No newline at end of file
@ECHO running apq-other-service ...
net start apq-control-service
net start apq-info-service
net start apq-register-service
@ECHO DONE.
:END
\ No newline at end of file
cd /d "%~dp0"
%1 %2
ver|find "5.">nul&&goto :st
mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :st","","runas",0)(window.close)&goto :eof
:st
copy "%~0" "%windir%\system32\"
start apq-client -Xms256m -Xmx256m -Dfile.encoding=utf-8 -jar "%~dp0\apq-pc-client-0.0.1-SNAPSHOT-boot.jar"
exit
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
@ECHO OFF
setlocal enabledelayedexpansion
@ECHO Stopping apq-control-service ...
net stop apq-control-service
@ECHO Uninstalling apq-control-service ...
"%~dp0apq-control-service.exe" uninstall
@ECHO DONE.
:END
\ No newline at end of file
cd /d "%~dp0"
setlocal enabledelayedexpansion
for /F "TOKENS=1,2,*" %%a in ('jps -m ^| findstr apq-pc-control') do set SPID=%%a
TASKKILL /F /PID %SPID%
echo 删除服务完毕
exit
\ No newline at end of file
@ECHO OFF
setlocal ENABLEEXTENSIONS
@ECHO Installing apq-control-service ...
"%~dp0apq-control-service.exe" install
@ECHO running apq-control-service ...
"%~dp0apq-control-service.exe" start
@ECHO DONE.
:END
\ No newline at end of file
cd /d "%~dp0"
::start xx.exe
for /F "TOKENS=1,2,*" %%a in ('jps -m ^| findstr apq-pc-control') do set SPID=%%a
TASKKILL /F /PID %SPID%
start apq-control -Xms256m -Xmx256m -Dfile.encoding=utf-8 -jar "%~dp0\apq-pc-control-1.0-SNAPSHOT-boot.jar"
echo start apq control service
exit
\ No newline at end of file
cd /d "%~dp0"
%1 %2
ver|find "5.">nul&&goto :st
mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :st","","runas",0)(window.close)&goto :eof
:st
copy "%~0" "%windir%\system32\"
start apq-control -Xms256m -Xmx256m -Dfile.encoding=utf-8 -jar "%~dp0\apq-pc-control-1.0-SNAPSHOT-boot.jar"
exit
\ No newline at end of file
@ECHO OFF
setlocal ENABLEEXTENSIONS
@ECHO Installing apq-control-service ...
"%~dp0apq-control-service.exe" install
@ECHO running apq-control-service ...
"%~dp0apq-control-service.exe" start
@ECHO DONE.
:END
\ No newline at end of file
......@@ -8,9 +8,8 @@
#define MyAppDirName "apq-info"
#define MyAppEnName "apq-info"
#define MyAppExeName "apq-info.exe"
#define MyAppReBootName "service\启动服务R.bat"
[Setup]
[Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (生成新的GUID,点击 工具|在IDE中生成GUID。)
......@@ -29,7 +28,7 @@ DefaultGroupName={#MyAppName}
SetupIconFile=logo.ico
;安装包文件输出目录
OutputDir=..\dist\
OutputDir=..\dist\
;安装包文件名
OutputBaseFilename={#MyAppName}
......@@ -54,23 +53,22 @@ Source: "../apq-info/*"; Excludes: "bak"; DestDir: "{app}"; Flags: ignoreversion
[Icons]
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
[Run]
[Run]
Filename: "{app}\service\启动服务.bat"; Parameters:"""D:\Program Files (x86)\apq-client\jre"" ""{app}\config.ini""";Flags:runhidden runascurrentuser waituntilterminated;
;卸载后执行的操作(停止、删除各种服务)
[UninstallRun]
[UninstallRun]
Filename: "{app}\service\删除服务.bat"; Flags: runhidden;
;卸载后删除目录所有文件,删除空目录
[UninstallDelete]
Type: filesandordirs; Name: "{app}\*"
Type: filesandordirs; Name: "{app}\*"
Type: dirifempty; Name: "{app}"
;操作注册表
[Registry]
Root: HKLM; Subkey: "Software\{#MyAppEnName}"; Flags: uninsdeletekey;
Root: HKCU; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "{#MyAppEnName}"; ValueData: "{app}\{#MyAppReBootName}"; Flags: uninsdeletevalue;
[Code]
const EnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
......
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "阿普奇采集程序"
#define MyAppVersion "V1.0"
#define MyAppPublisher "阿普奇"
#define MyAppURL "https://www.apq.com/"
#define MyAppDirName "apq-info"
#define MyAppEnName "apq-info"
#define MyAppExeName "apq-info.exe"
#define MyAppReBootName "service\启动服务R.bat"
[Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (生成新的GUID,点击 工具|在IDE中生成GUID。)
ChangesEnvironment=yes
DisableDirPage=no
AppId={{1394783A-5D3C-48CD-0001-E2DFBB844E42}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppDirName}
DefaultGroupName={#MyAppName}
SetupIconFile=logo.ico
;安装包文件输出目录
OutputDir=..\dist\
;安装包文件名
OutputBaseFilename={#MyAppName}
;压缩文件
Compression=lzma
SolidCompression=yes
;以管理员权限运行
PrivilegesRequired=admin
UninstallDisplayIcon={app}/{#MyAppExeName}
VersionInfoVersion=1.0.0.0
[Languages]
Name: "chinesesimp"; MessagesFile: "compiler:Languages/Chinese.isl"
[Files]
Source: "../apq-info/*"; Excludes: "bak"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
[Run]
Filename: "{app}\service\启动服务.bat"; Parameters:"""D:\Program Files (x86)\apq-client\jre"" ""{app}\config.ini""";Flags:runhidden runascurrentuser waituntilterminated;
;卸载后执行的操作(停止、删除各种服务)
[UninstallRun]
Filename: "{app}\service\删除服务.bat"; Flags: runhidden;
;卸载后删除目录所有文件,删除空目录
[UninstallDelete]
Type: filesandordirs; Name: "{app}\*"
Type: dirifempty; Name: "{app}"
;操作注册表
[Registry]
Root: HKLM; Subkey: "Software\{#MyAppEnName}"; Flags: uninsdeletekey;
Root: HKCU; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "{#MyAppEnName}"; ValueData: "{app}\{#MyAppReBootName}"; Flags: uninsdeletevalue;
[Code]
const EnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
function CheckProcessRunning( aProcName,
aProcDesc: string ): boolean;
var
ShellResult: boolean;
ResultCode: integer;
cmd: string;
sl: TStringList;
f: string;
d: string;
cmd2: string;
f2: string;
sl2: TStringList;
begin
cmd := 'for /f "delims=," %%i ' +
'in (''tasklist /FI "IMAGENAME eq ' + aProcName + '" /FO CSV'') ' +
'do if "%%~i"=="' + aProcName + '" exit 1';
f := 'CheckProc.cmd';
cmd2 := 'taskkill -f -t -im ' + aProcName;
f2 := 'KillProc.cmd';
d := AddBackSlash( ExpandConstant( '{tmp}' ));
sl := TStringList.Create;
sl.Add( cmd );
sl.Add( 'exit /0' );
sl.SaveToFile( d + f );
sl.Free;
sl2 := TStringList.Create;
sl2.Add( cmd2 );
sl2.Add( 'exit /0' );
sl2.SaveToFile( d + f2 );
sl2.Free;
Result := true;
while ( Result ) do
begin
ResultCode := 1;
ShellResult := Exec( f,
'',
d,
SW_HIDE,
ewWaitUntilTerminated,
ResultCode );
Result := ResultCode > 0;
if Result then
begin
Msgbox('已关闭正在运行' + aProcDesc + '客户端!', mbInformation, MB_OK);
ShellResult := Exec( f2,
'',
d,
SW_HIDE,
ewWaitUntilTerminated,
ResultCode );
end;
end;
DeleteFile( d + f );
DeleteFile( d + f2 );
end;
function EnvGetJavaHomePath() : string;
var javaHome: string;
begin
RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'JAVA_HOME', javaHome)
Result := javaHome;
end;
// Perform some initializations. Return False to abort setup
function InitializeSetup: Boolean;
begin
// Do not use any user defined vars in here such as {app}
// Result := not ( CheckProcessRunning( 'apq-info-service.exe', 'apq客户端插件' ));
Result := not ( CheckProcessRunning( 'apq-info.exe', 'apq-info' ));
end;
\ No newline at end of file
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "阿普奇采集程序"
#define MyAppVersion "V1.0"
#define MyAppPublisher "阿普奇"
#define MyAppURL "https://www.apq.com/"
#define MyAppDirName "apq-info"
#define MyAppEnName "apq-info"
#define MyAppExeName "apq-info.exe"
[Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (生成新的GUID,点击 工具|在IDE中生成GUID。)
ChangesEnvironment=yes
DisableDirPage=no
AppId={{1394783A-5D3C-48CD-0001-E2DFBB844E42}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppDirName}
DefaultGroupName={#MyAppName}
SetupIconFile=logo.ico
;安装包文件输出目录
OutputDir=..\dist\
;安装包文件名
OutputBaseFilename={#MyAppName}
;压缩文件
Compression=lzma
SolidCompression=yes
;以管理员权限运行
PrivilegesRequired=admin
UninstallDisplayIcon={app}/{#MyAppExeName}
VersionInfoVersion=1.0.0.0
[Languages]
Name: "chinesesimp"; MessagesFile: "compiler:Languages/Chinese.isl"
[Files]
Source: "../apq-info/*"; Excludes: "bak"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
[Run]
Filename: "{app}\service\启动服务.bat"; Parameters:"""D:\Program Files (x86)\apq-client\jre"" ""{app}\config.ini""";Flags:runhidden runascurrentuser waituntilterminated;
;卸载后执行的操作(停止、删除各种服务)
[UninstallRun]
Filename: "{app}\service\删除服务.bat"; Flags: runhidden;
;卸载后删除目录所有文件,删除空目录
[UninstallDelete]
Type: filesandordirs; Name: "{app}\*"
Type: dirifempty; Name: "{app}"
;操作注册表
[Registry]
Root: HKLM; Subkey: "Software\{#MyAppEnName}"; Flags: uninsdeletekey;
[Code]
const EnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
function CheckProcessRunning( aProcName,
aProcDesc: string ): boolean;
var
ShellResult: boolean;
ResultCode: integer;
cmd: string;
sl: TStringList;
f: string;
d: string;
cmd2: string;
f2: string;
sl2: TStringList;
begin
cmd := 'for /f "delims=," %%i ' +
'in (''tasklist /FI "IMAGENAME eq ' + aProcName + '" /FO CSV'') ' +
'do if "%%~i"=="' + aProcName + '" exit 1';
f := 'CheckProc.cmd';
cmd2 := 'taskkill -f -t -im ' + aProcName;
f2 := 'KillProc.cmd';
d := AddBackSlash( ExpandConstant( '{tmp}' ));
sl := TStringList.Create;
sl.Add( cmd );
sl.Add( 'exit /0' );
sl.SaveToFile( d + f );
sl.Free;
sl2 := TStringList.Create;
sl2.Add( cmd2 );
sl2.Add( 'exit /0' );
sl2.SaveToFile( d + f2 );
sl2.Free;
Result := true;
while ( Result ) do
begin
ResultCode := 1;
ShellResult := Exec( f,
'',
d,
SW_HIDE,
ewWaitUntilTerminated,
ResultCode );
Result := ResultCode > 0;
if Result then
begin
Msgbox('已关闭正在运行' + aProcDesc + '客户端!', mbInformation, MB_OK);
ShellResult := Exec( f2,
'',
d,
SW_HIDE,
ewWaitUntilTerminated,
ResultCode );
end;
end;
DeleteFile( d + f );
DeleteFile( d + f2 );
end;
function EnvGetJavaHomePath() : string;
var javaHome: string;
begin
RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'JAVA_HOME', javaHome)
Result := javaHome;
end;
// Perform some initializations. Return False to abort setup
function InitializeSetup: Boolean;
begin
// Do not use any user defined vars in here such as {app}
// Result := not ( CheckProcessRunning( 'apq-info-service.exe', 'apq客户端插件' ));
Result := not ( CheckProcessRunning( 'apq-info.exe', 'apq-info' ));
end;
\ No newline at end of file
@ECHO OFF
setlocal enabledelayedexpansion
@ECHO Stopping apq-info-service ...
net stop apq-info-service
@ECHO Uninstalling apq-info-service ...
"%~dp0apq-info-service.exe" uninstall
@ECHO DONE.
@ECHO OFF
setlocal enabledelayedexpansion
@ECHO Stopping apq-info-service ...
net stop apq-info-service
@ECHO Uninstalling apq-info-service ...
"%~dp0apq-info-service.exe" uninstall
@ECHO DONE.
:END
\ No newline at end of file
@ECHO OFF
setlocal ENABLEEXTENSIONS
@ECHO Installing apq-info-service ...
"%~dp0apq-info-service.exe" install
@ECHO running apq-info-service ...
"%~dp0apq-info-service.exe" start
@ECHO DONE.
@ECHO OFF
setlocal ENABLEEXTENSIONS
@ECHO Installing apq-info-service ...
"%~dp0apq-info-service.exe" install
@ECHO running apq-info-service ...
"%~dp0apq-info-service.exe" start
@ECHO DONE.
:END
\ No newline at end of file
cd /d "%~dp0"
%1 %2
ver|find "5.">nul&&goto :st
mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :st","","runas",0)(window.close)&goto :eof
:st
copy "%~0" "%windir%\system32\"
start apq-info -Xms256m -Xmx256m -Dfile.encoding=utf-8 -jar "%~dp0\apq-pc-info-1.0-SNAPSHOT-boot.jar"
exit
\ No newline at end of file
......@@ -8,7 +8,6 @@
#define MyAppDirName "apq-register"
#define MyAppEnName "apq-register"
#define MyAppExeName "apq-register.exe"
#define MyAppReBootName "service\启动服务R.bat"
[Setup]
; 注: AppId的值为单独标识该应用程序。
......@@ -35,8 +34,8 @@ OutputDir=..\dist\
OutputBaseFilename={#MyAppName}
;压缩文件
Compression=lzma
SolidCompression=yes
Compression=lzma
SolidCompression=yes
;以管理员权限运行
PrivilegesRequired=admin
......@@ -54,11 +53,11 @@ Source: "../apq-register/*"; Excludes: "bak"; DestDir: "{app}"; Flags: ignorever
[Icons]
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
[Run]
[Run]
Filename: "{app}\service\启动服务.bat"; Flags: runhidden;
;卸载后执行的操作(停止、删除各种服务)
[UninstallRun]
;卸载后执行的操作(停止、删除各种服务)
[UninstallRun]
Filename: "{app}\service\删除服务.bat"; Flags: runhidden;
;卸载后删除目录所有文件,删除空目录
......@@ -69,7 +68,6 @@ Type: dirifempty; Name: "{app}"
;操作注册表
[Registry]
Root: HKLM; Subkey: "Software\{#MyAppEnName}"; Flags: uninsdeletekey;
Root: HKCU; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "{#MyAppEnName}"; ValueData: "{app}\{#MyAppReBootName}"; Flags: uninsdeletevalue;
[Code]
......
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "阿普奇软件检测程序"
#define MyAppVersion "V1.0"
#define MyAppPublisher "阿普奇"
#define MyAppURL "https://www.apq.com/"
#define MyAppDirName "apq-register"
#define MyAppEnName "apq-register"
#define MyAppExeName "apq-register.exe"
#define MyAppReBootName "service\启动服务R.bat"
[Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (生成新的GUID,点击 工具|在IDE中生成GUID。)
ChangesEnvironment=yes
DisableDirPage=no
AppId={{1394783A-5D3C-48CD-0002-E2DFBB844E42}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppDirName}
DefaultGroupName={#MyAppName}
SetupIconFile=logo.ico
;安装包文件输出目录
OutputDir=..\dist\
;安装包文件名
OutputBaseFilename={#MyAppName}
;压缩文件
Compression=lzma
SolidCompression=yes
;以管理员权限运行
PrivilegesRequired=admin
UninstallDisplayIcon={app}/{#MyAppExeName}
VersionInfoVersion=1.0.0.0
[Languages]
Name: "chinesesimp"; MessagesFile: "compiler:Languages/Chinese.isl"
[Files]
Source: "../apq-register/*"; Excludes: "bak"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
[Run]
Filename: "{app}\service\启动服务.bat"; Flags: runhidden;
;卸载后执行的操作(停止、删除各种服务)
[UninstallRun]
Filename: "{app}\service\删除服务.bat"; Flags: runhidden;
;卸载后删除目录所有文件,删除空目录
[UninstallDelete]
Type: filesandordirs; Name: "{app}\*"
Type: dirifempty; Name: "{app}"
;操作注册表
[Registry]
Root: HKLM; Subkey: "Software\{#MyAppEnName}"; Flags: uninsdeletekey;
Root: HKCU; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "{#MyAppEnName}"; ValueData: "{app}\{#MyAppReBootName}"; Flags: uninsdeletevalue;
[Code]
function CheckProcessRunning( aProcName,
aProcDesc: string ): boolean;
var
ShellResult: boolean;
ResultCode: integer;
cmd: string;
sl: TStringList;
f: string;
d: string;
cmd2: string;
f2: string;
sl2: TStringList;
begin
cmd := 'for /f "delims=," %%i ' +
'in (''tasklist /FI "IMAGENAME eq ' + aProcName + '" /FO CSV'') ' +
'do if "%%~i"=="' + aProcName + '" exit 1';
f := 'CheckProc.cmd';
cmd2 := 'taskkill -f -t -im ' + aProcName;
f2 := 'KillProc.cmd';
d := AddBackSlash( ExpandConstant( '{tmp}' ));
sl := TStringList.Create;
sl.Add( cmd );
sl.Add( 'exit /0' );
sl.SaveToFile( d + f );
sl.Free;
sl2 := TStringList.Create;
sl2.Add( cmd2 );
sl2.Add( 'exit /0' );
sl2.SaveToFile( d + f2 );
sl2.Free;
Result := true;
while ( Result ) do
begin
ResultCode := 1;
ShellResult := Exec( f,
'',
d,
SW_HIDE,
ewWaitUntilTerminated,
ResultCode );
Result := ResultCode > 0;
if Result then
begin
Msgbox('已关闭正在运行' + aProcDesc + '客户端!', mbInformation, MB_OK);
ShellResult := Exec( f2,
'',
d,
SW_HIDE,
ewWaitUntilTerminated,
ResultCode );
end;
end;
DeleteFile( d + f );
DeleteFile( d + f2 );
end;
// Perform some initializations. Return False to abort setup
function InitializeSetup: Boolean;
begin
// Do not use any user defined vars in here such as {app}
// Result := not ( CheckProcessRunning( 'apq-register-service.exe', 'apq客户端插件' ));
Result := not ( CheckProcessRunning( 'apq-register.exe', 'apq-register' ));
end;
\ No newline at end of file
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "阿普奇软件检测程序"
#define MyAppVersion "V1.0"
#define MyAppPublisher "阿普奇"
#define MyAppURL "https://www.apq.com/"
#define MyAppDirName "apq-register"
#define MyAppEnName "apq-register"
#define MyAppExeName "apq-register.exe"
[Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (生成新的GUID,点击 工具|在IDE中生成GUID。)
ChangesEnvironment=yes
DisableDirPage=no
AppId={{1394783A-5D3C-48CD-0002-E2DFBB844E42}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppDirName}
DefaultGroupName={#MyAppName}
SetupIconFile=logo.ico
;安装包文件输出目录
OutputDir=..\dist\
;安装包文件名
OutputBaseFilename={#MyAppName}
;压缩文件
Compression=lzma
SolidCompression=yes
;以管理员权限运行
PrivilegesRequired=admin
UninstallDisplayIcon={app}/{#MyAppExeName}
VersionInfoVersion=1.0.0.0
[Languages]
Name: "chinesesimp"; MessagesFile: "compiler:Languages/Chinese.isl"
[Files]
Source: "../apq-register/*"; Excludes: "bak"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
[Run]
Filename: "{app}\service\启动服务.bat"; Flags: runhidden;
;卸载后执行的操作(停止、删除各种服务)
[UninstallRun]
Filename: "{app}\service\删除服务.bat"; Flags: runhidden;
;卸载后删除目录所有文件,删除空目录
[UninstallDelete]
Type: filesandordirs; Name: "{app}\*"
Type: dirifempty; Name: "{app}"
;操作注册表
[Registry]
Root: HKLM; Subkey: "Software\{#MyAppEnName}"; Flags: uninsdeletekey;
[Code]
function CheckProcessRunning( aProcName,
aProcDesc: string ): boolean;
var
ShellResult: boolean;
ResultCode: integer;
cmd: string;
sl: TStringList;
f: string;
d: string;
cmd2: string;
f2: string;
sl2: TStringList;
begin
cmd := 'for /f "delims=," %%i ' +
'in (''tasklist /FI "IMAGENAME eq ' + aProcName + '" /FO CSV'') ' +
'do if "%%~i"=="' + aProcName + '" exit 1';
f := 'CheckProc.cmd';
cmd2 := 'taskkill -f -t -im ' + aProcName;
f2 := 'KillProc.cmd';
d := AddBackSlash( ExpandConstant( '{tmp}' ));
sl := TStringList.Create;
sl.Add( cmd );
sl.Add( 'exit /0' );
sl.SaveToFile( d + f );
sl.Free;
sl2 := TStringList.Create;
sl2.Add( cmd2 );
sl2.Add( 'exit /0' );
sl2.SaveToFile( d + f2 );
sl2.Free;
Result := true;
while ( Result ) do
begin
ResultCode := 1;
ShellResult := Exec( f,
'',
d,
SW_HIDE,
ewWaitUntilTerminated,
ResultCode );
Result := ResultCode > 0;
if Result then
begin
Msgbox('已关闭正在运行' + aProcDesc + '客户端!', mbInformation, MB_OK);
ShellResult := Exec( f2,
'',
d,
SW_HIDE,
ewWaitUntilTerminated,
ResultCode );
end;
end;
DeleteFile( d + f );
DeleteFile( d + f2 );
end;
// Perform some initializations. Return False to abort setup
function InitializeSetup: Boolean;
begin
// Do not use any user defined vars in here such as {app}
// Result := not ( CheckProcessRunning( 'apq-register-service.exe', 'apq客户端插件' ));
Result := not ( CheckProcessRunning( 'apq-register.exe', 'apq-register' ));
end;
\ No newline at end of file
@ECHO OFF
setlocal enabledelayedexpansion
@ECHO Stopping apq-register-service ...
net stop apq-register-service
@ECHO Uninstalling apq-register-service ...
"%~dp0apq-register-service.exe" uninstall
@ECHO DONE.
@ECHO OFF
setlocal enabledelayedexpansion
@ECHO Stopping apq-register-service ...
net stop apq-register-service
@ECHO Uninstalling apq-register-service ...
"%~dp0apq-register-service.exe" uninstall
@ECHO DONE.
:END
\ No newline at end of file
@ECHO OFF
setlocal ENABLEEXTENSIONS
@ECHO Installing apq-register-service ...
"%~dp0apq-register-service.exe" install
@ECHO running apq-register-service ...
"%~dp0apq-register-service.exe" start
@ECHO DONE.
@ECHO OFF
setlocal ENABLEEXTENSIONS
@ECHO Installing apq-register-service ...
"%~dp0apq-register-service.exe" install
@ECHO running apq-register-service ...
"%~dp0apq-register-service.exe" start
@ECHO DONE.
:END
\ No newline at end of file
cd /d "%~dp0"
%1 %2
ver|find "5.">nul&&goto :st
mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :st","","runas",0)(window.close)&goto :eof
:st
copy "%~0" "%windir%\system32\"
start apq-register -Xms256m -Xmx256m -Dfile.encoding=utf-8 -jar "%~dp0\apq-pc-register-1.0-SNAPSHOT-boot.jar"
exit
\ No newline at end of file
ECHO 处于打开状态。
ECHO 处于打开状态。
ECHO 处于打开状态。
cd /d "%~dp0"
setlocal enabledelayedexpansion
echo %1 >> ./childprocess.txt
start cmd /c %1
exit
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论