-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_windows.bat
More file actions
69 lines (54 loc) · 1.83 KB
/
install_windows.bat
File metadata and controls
69 lines (54 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
@echo off
:: prompt user to get elevated priviledge for installation
::-------------------------------------
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"="
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
pushd "%CD%"
CD /D "%~dp0"
::--------------------------------------
::ENTER YOUR CODE BELOW:
:: Delete windows service service if it exists and create new one
SC QUERY WOLServerService > NUL
IF ERRORLEVEL 1060 GOTO MISSING
ECHO service exist stopping then deleting service
sc stop WOLServerService
sc delete WOLServerService
GOTO NOSERVICE
:MISSING
ECHO service does not exist creating new one...
:NOSERVICE
:: kill any existing client
QPROCESS "wolwebservice.exe">NUL 2> nul
IF %ERRORLEVEL% EQU 0 taskkill /IM wolservice.exe
timeout 2
::Copy binaries to target destination
::Check of C:\wolservice\ folder exists if not create it
IF EXIST C:\wolservice\ GOTO FOLDEREXISTS
MKDIR C:\wolservice\
GOTO INSTALL
:FOLDEREXISTS
::Delete old wolwebservice.exe
del C:\wolservice\wolwebservice.exe
del C:\wolservice\efiDLL.dll
:INSTALL
echo f | xcopy /f /y build\dist\wolwebservice c:\wolservice\wolwebservice.exe
echo f | xcopy /f /y build\dist\efiDLL.dll c:\wolservice\
echo "Creating windows service"
::Create windows service
sc create WOLServerService binPath="C:\wolservice\wolwebservice.exe"
sc config WOLServerService start= auto
sc start WOLServerService
timeout 5