Skip to content

Commit 2c79601

Browse files
committed
feat: win下添加依赖库安装脚本
1 parent 44f26f1 commit 2c79601

2 files changed

Lines changed: 84 additions & 0 deletions

File tree

.github/workflows/install.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ jobs:
115115
else
116116
echo "MFA directory not found, skipping copy."
117117
fi
118+
if [[ "${{ matrix.os }}" == "win" ]]; then
119+
mkdir -p install
120+
cp -v "tools/DependencySetup_依赖库安装.bat" install/
121+
fi
118122
else
119123
echo "Skipping copy MFA for Android."
120124
fi
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
@echo off
2+
chcp 65001
3+
setlocal enabledelayedexpansion
4+
5+
:: 定义ANSI颜色代码
6+
for /f %%a in ('echo prompt $E^| cmd') do set "ESC=%%a"
7+
set "RESET=%ESC%[0m"
8+
set "GREEN=%ESC%[32m"
9+
set "RED=%ESC%[31m"
10+
set "YELLOW=%ESC%[33m"
11+
set "BLUE=%ESC%[34m"
12+
set "CYAN=%ESC%[36m"
13+
set "WHITE=%ESC%[37m"
14+
set "BOLD=%ESC%[1m"
15+
16+
:: 初始化错误标志
17+
set "ErrorOccurred=0"
18+
19+
openfiles >nul 2>&1
20+
if %errorlevel% neq 0 (
21+
echo %YELLOW%正在获取管理员权限...%RESET%
22+
echo %YELLOW%Obtaining administrator privileges...%RESET%
23+
powershell -Command "Start-Process cmd.exe -ArgumentList '/c %~f0' -Verb RunAs"
24+
exit /b
25+
)
26+
27+
echo.
28+
echo %BLUE%====================================================================================================%RESET%
29+
echo %BOLD%%CYAN%正在安装 Microsoft Visual C++ Redistributable%RESET%
30+
echo %BOLD%%CYAN%Installing Microsoft Visual C++ Redistributable%RESET%
31+
echo.
32+
33+
echo %YELLOW%如果是第一次使用 winget,可能会提示接受协议,请输入 Y 并按回车继续%RESET%
34+
echo %YELLOW%If this is your first time using winget, you may be prompted to accept the terms. %RESET%
35+
echo %YELLOW%Please enter Y and press Enter to continue.%RESET%
36+
echo.
37+
38+
winget install "Microsoft.VCRedist.2015+.x64" --override "/repair /passive /norestart" --uninstall-previous --accept-package-agreements --force
39+
if %errorlevel% neq 0 (
40+
set "ErrorOccurred=1"
41+
)
42+
echo %BLUE%====================================================================================================%RESET%
43+
44+
echo.
45+
echo %BLUE%====================================================================================================%RESET%
46+
echo %BOLD%%CYAN%正在安装 .NET Desktop Runtime 8.0%RESET%
47+
echo %BOLD%%CYAN%Installing .NET Desktop Runtime 8.0%RESET%
48+
echo.
49+
50+
winget install "Microsoft.DotNet.DesktopRuntime.8" --override "/repair /passive /norestart" --uninstall-previous --accept-package-agreements --force
51+
if %errorlevel% neq 0 (
52+
set "ErrorOccurred=1"
53+
)
54+
echo %BLUE%====================================================================================================%RESET%
55+
56+
echo.
57+
if %ErrorOccurred% equ 0 (
58+
echo %BOLD%%GREEN%运行库修复完成,请重启电脑后再次尝试运行 M9A。%RESET%
59+
echo %BOLD%%GREEN%The runtime library repair is complete. Please restart your computer and try running MAA again.%RESET%
60+
) else (
61+
echo %RED%====================================================================================================%RESET%
62+
echo %BOLD%%RED%运行库修复过程中出现错误%RESET%
63+
echo %BOLD%%RED%Errors occurred during runtime library repair%RESET%
64+
echo.
65+
echo %YELLOW%如果提示%RESET% %WHITE%'winget' is not...%RESET% %YELLOW%说明您的电脑版本太老了,没有自带 winget%RESET%
66+
echo %YELLOW%If the prompt shows%RESET% %WHITE%'winget' is not...%RESET% %YELLOW%it means your system is too old and don't include winget by default.%RESET%
67+
echo.
68+
echo %YELLOW%您可以手动将以下两个链接复制到浏览器中打开,下载并安装所需组件。如果安装成功,无需再次运行本依赖库安装脚本。%RESET%
69+
echo %YELLOW%You can manually copy the following two links into your browser to download and install the required components.%RESET%
70+
echo %YELLOW%If the installation is successful, you don't need to run this dependency installation script again.%RESET%
71+
echo.
72+
echo %WHITE%Microsoft Visual C++ Redistributable:%RESET%
73+
echo %CYAN%https://aka.ms/vs/17/release/vc_redist.x64.exe%RESET%
74+
echo.
75+
echo %WHITE%.NET Desktop Runtime 8.0:%RESET%
76+
echo %CYAN%https://aka.ms/dotnet/8.0/windowsdesktop-runtime-win-x64.exe%RESET%
77+
echo %RED%====================================================================================================%RESET%
78+
)
79+
80+
pause

0 commit comments

Comments
 (0)