-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautoupdater-service.cmd
More file actions
32 lines (32 loc) · 1.39 KB
/
autoupdater-service.cmd
File metadata and controls
32 lines (32 loc) · 1.39 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
@echo off & cd /d "%~dp0"
setlocal EnableDelayedExpansion
if exist "%CD%\AUTO.no" GOTO Service
for %%I in (VERSION*) do set "UPD=%%~nxI"
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://ipfs.io/ipns/link/%UPD%', '%temp%\%UPD%')" >nul
if %errorlevel% NEQ 0 (
sc query "Service" >nul
if !errorlevel! EQU 0 set "CHECK=0" & goto Service
:Loop
choice /c 123 /n /m "The local version does not match the latest version. Do you want to update and start service (1), update without starting service (2), or disable autoupdate (3, delete AUTO.no to enable again)?"
if !errorlevel! EQU 1 set "UPDATE=0"
if !errorlevel! EQU 3 type nul > "%CD%\AUTO.no" & GOTO Service
echo @echo off>"%temp%\autoupdater.cmd"
echo call "%CD%\updater.cmd">>"%temp%\autoupdater.cmd"
echo cls>>"%temp%\autoupdater.cmd"
echo :Wait>>"%temp%\autoupdater.cmd"
echo if not exist "%CD%\file.any" GOTO Wait>>"%temp%\autoupdater.cmd"
echo timeout /t 1 /nobreak>>"%temp%\autoupdater.cmd"
echo if "!UPDATE!" EQU "0" call "%CD%\%~nx0">>"%temp%\autoupdater.cmd"
echo del "%temp%\autoupdater.cmd">>"%temp%\autoupdater.cmd"
start "" cmd /c "%temp%\autoupdater.cmd"
exit
)
del "%temp%\%UPD%"
:Service
if "%CHECK%" EQU "1" if "!UPDATE!" NEQ "0" exit
...
Echo/
Echo Please don't close this window, I will finish the work and check version...
timeout /t 3 /nobreak
Echo/
if "%CHECK%" EQU "0" set "CHECK=1" & goto Loop