@@ -16,6 +16,33 @@ set "BOLD=%ESC%[1m"
1616:: 初始化错误标志
1717set " ErrorOccurred = 0"
1818
19+ :: 检测系统架构
20+ set " ARCH = %PROCESSOR_ARCHITECTURE% "
21+ if /i " %ARCH% " == " AMD64" (
22+ set " ARCH_NAME = x64"
23+ set " VC_PACKAGE = Microsoft.VCRedist.2015+.x64"
24+ set " VC_DOWNLOAD = https://aka.ms/vs/17/release/vc_redist.x64.exe"
25+ set " DOTNET_DOWNLOAD = https://aka.ms/dotnet/10.0/windowsdesktop-runtime-win-x64.exe"
26+ ) else if /i " %ARCH% " == " x86" (
27+ set " ARCH_NAME = x86"
28+ set " VC_PACKAGE = Microsoft.VCRedist.2015+.x86"
29+ set " VC_DOWNLOAD = https://aka.ms/vs/17/release/vc_redist.x86.exe"
30+ set " DOTNET_DOWNLOAD = https://aka.ms/dotnet/10.0/windowsdesktop-runtime-win-x86.exe"
31+ ) else if /i " %ARCH% " == " ARM64" (
32+ set " ARCH_NAME = ARM64"
33+ set " VC_PACKAGE = Microsoft.VCRedist.2015+.arm64"
34+ set " VC_DOWNLOAD = https://aka.ms/vs/17/release/vc_redist.arm64.exe"
35+ set " DOTNET_DOWNLOAD = https://aka.ms/dotnet/10.0/windowsdesktop-runtime-win-arm64.exe"
36+ ) else (
37+ echo %RED% 不支持的系统架构: %ARCH%%RESET%
38+ echo %RED% Unsupported system architecture: %ARCH%%RESET%
39+ pause
40+ exit /b 1
41+ )
42+
43+ echo %CYAN% 检测到系统架构 / Detected system architecture: %BOLD%%ARCH_NAME%%RESET%
44+ echo .
45+
1946openfiles > nul 2 >& 1
2047if %errorlevel% neq 0 (
2148 echo %YELLOW% 正在获取管理员权限...%RESET%
@@ -24,27 +51,27 @@ if %errorlevel% neq 0 (
2451 exit /b
2552)
2653
54+ echo .
2755echo .
2856echo %BLUE% ====================================================================================================%RESET%
29- echo %BOLD%%CYAN% 正在安装 Microsoft Visual C++ Redistributable%RESET%
30- echo %BOLD%%CYAN% Installing Microsoft Visual C++ Redistributable%RESET%
57+ echo %BOLD%%CYAN% 正在安装 Microsoft Visual C++ Redistributable ( %ARCH_NAME% ) %RESET%
58+ echo %BOLD%%CYAN% Installing Microsoft Visual C++ Redistributable ( %ARCH_NAME% ) %RESET%
3159echo .
32-
3360echo %YELLOW% 如果是第一次使用 winget,可能会提示接受协议,请输入 Y 并按回车继续%RESET%
3461echo %YELLOW% If this is your first time using winget, you may be prompted to accept the terms. %RESET%
3562echo %YELLOW% Please enter Y and press Enter to continue.%RESET%
3663echo .
3764
38- winget install " Microsoft.VCRedist.2015+.x64 " --override " /repair /passive /norestart" --uninstall-previous --accept-package-agreements --force
65+ winget install " %VC_PACKAGE% " --override " /repair /passive /norestart" --uninstall-previous --accept-package-agreements --force
3966if %errorlevel% neq 0 (
4067 set " ErrorOccurred = 1"
4168)
4269echo %BLUE% ====================================================================================================%RESET%
4370
4471echo .
4572echo %BLUE% ====================================================================================================%RESET%
46- echo %BOLD%%CYAN% 正在安装 .NET Desktop Runtime 10.0%RESET%
47- echo %BOLD%%CYAN% Installing .NET Desktop Runtime 10.0%RESET%
73+ echo %BOLD%%CYAN% 正在安装 .NET Desktop Runtime 10.0 ( %ARCH_NAME% ) %RESET%
74+ echo %BOLD%%CYAN% Installing .NET Desktop Runtime 10.0 ( %ARCH_NAME% ) %RESET%
4875echo .
4976
5077winget install " Microsoft.DotNet.DesktopRuntime.10" --override " /repair /passive /norestart" --uninstall-previous --accept-package-agreements --force
@@ -69,11 +96,11 @@ if %ErrorOccurred% equ 0 (
6996 echo %YELLOW% You can manually copy the following two links into your browser to download and install the required components.%RESET%
7097 echo %YELLOW% If the installation is successful, you don't need to run this dependency installation script again.%RESET%
7198 echo .
72- echo %WHITE% Microsoft Visual C++ Redistributable:%RESET%
73- echo %CYAN% https://aka.ms/vs/17/release/vc_redist.x64.exe %RESET%
99+ echo %WHITE% Microsoft Visual C++ Redistributable ( %ARCH_NAME% ) :%RESET%
100+ echo %CYAN%%VC_DOWNLOAD% %RESET%
74101 echo .
75- echo %WHITE% .NET Desktop Runtime 10.0:%RESET%
76- echo %CYAN% https://aka.ms/dotnet/10.0/windowsdesktop-runtime-win-x64.exe %RESET%
102+ echo %WHITE% .NET Desktop Runtime 10.0 ( %ARCH_NAME% ) :%RESET%
103+ echo %CYAN%%DOTNET_DOWNLOAD% %RESET%
77104 echo %RED% ====================================================================================================%RESET%
78105)
79106
0 commit comments