-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall_stable.bat
52 lines (40 loc) · 1.4 KB
/
install_stable.bat
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
@echo off
setlocal
REM Set default command to download archive from
set DOWNLOAD_CMD=powershell -command "(New-Object System.Net.WebClient).DownloadFile"
REM Set default install prefix to C:\Program Files
set PREFIX=C:\Program Files
REM Check if the user is running as an administrator
@REM NET SESSION >NUL 2>&1
@REM if %ERRORLEVEL% NEQ 0 (
@REM echo Please run as administrator!
@REM exit /b 1
@REM )
REM Check for PowerShell and Invoke-WebRequest
echo Testing for PowerShell...
where powershell >NUL 2>&1
if %ERRORLEVEL% NEQ 0 (
echo PowerShell is not installed!
exit /b 1
)
echo Testing for Invoke-WebRequest...
powershell -command "if (!(Get-Command Invoke-WebRequest -ErrorAction SilentlyContinue)) { exit 1 }"
if "%ERRORLEVEL%" NEQ "0" (
echo Invoke-WebRequest is not available!
exit /b 1
)
cd %TEMP%
REM If the directory exists, delete it
if exist arithmetica-tui-install rmdir /s /q arithmetica-tui-install
mkdir arithmetica-tui-install
cd arithmetica-tui-install
REM Download the latest release
%DOWNLOAD_CMD /~https://github.com/avighnac/arithmetica-tui/releases/latest/download/arithmetica.exe arithmetica.exe
echo Successfully downloaded the latest release.
REM Copy the executable to %PREFIX%\arithmetica.exe
copy arithmetica.exe "%PREFIX%\arithmetica.exe"
echo Copied successfully!
REM Cleanup
cd ..
rmdir /s /q arithmetica-tui-install
exit /b 0