summaryrefslogtreecommitdiff
path: root/src/SMAPI.Installer/assets/windows-install.bat
blob: e34b95549707179ea95618f251d9a3ec2878b21d (plain)
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
@echo off
setlocal enabledelayedexpansion

SET installerDir="%~dp0"

REM make sure we're not running within a zip folder
echo %installerDir% | findstr /C:"%TEMP%" 1>nul
if %ERRORLEVEL% EQU 0 (
    echo Oops! It looks like you're running the installer from inside a zip file. Make sure you unzip the download first.
    echo.
    pause
    exit
)

REM make sure .NET 5 is installed
SET hasNet5=1
WHERE dotnet /q
if !ERRORLEVEL! NEQ 0 (
    SET hasNet5=0
) else (
    dotnet --info | findstr /C:"Microsoft.WindowsDesktop.App 5." 1>nul
    if !ERRORLEVEL! NEQ 0 (
        SET hasNet5=0
    )
)
if "%hasNet5%" == "0" (
    echo Oops! You don't have the required .NET version installed.
    echo.
    echo To install it:
    echo    1. Go to https://dotnet.microsoft.com/download/dotnet/5.0/runtime

    if "%PROCESSOR_ARCHITECTURE%" == "ARM64" (
        echo    2. Under "Run desktop apps", click "Download Arm64".
    ) else (
        echo    2. Under "Run desktop apps", click "Download x64".
    )

    echo    3. Run the downloaded installer.
    echo    4. Restart your computer.
    echo.
    pause
    exit
)

REM make sure an antivirus hasn't deleted the installer DLL
if not exist %installerDir%"internal\windows\SMAPI.Installer.dll" (
    echo Oops! SMAPI is missing one of its files. Your antivirus might have deleted it.
    echo Missing file: %installerDir%internal\windows\SMAPI.Installer.dll
    echo.
    pause
    exit
)

REM start installer
dotnet internal\windows\SMAPI.Installer.dll

REM keep window open if it failed
if %ERRORLEVEL% NEQ 0 (
    echo.
    echo Oops! The SMAPI installer seems to have failed. The error details may be shown above.
    echo.
    pause
    exit
)