From ae69f6a841630ac9ad9647fc40b1740a90c4ae84 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Thu, 17 Apr 2025 21:10:25 +0800 Subject: [PATCH] =?UTF-8?q?core:=20=E4=BC=98=E5=8C=96=20windows=20?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E6=96=87=E4=BB=B6=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reinstall.bat | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/reinstall.bat b/reinstall.bat index 40a346b..a34aa22 100644 --- a/reinstall.bat +++ b/reinstall.bat @@ -126,11 +126,8 @@ call :check_cygwin_installed || ( --packages %pkgs% rem 检查 Cygwin 是否成功安装 - if errorlevel 1 ( - goto :install_cygwin_failed - ) else ( - call :check_cygwin_installed || goto :install_cygwin_failed - ) + if errorlevel 1 goto :install_cygwin_failed + call :check_cygwin_installed || goto :install_cygwin_failed ) rem 在c盘根目录下执行 cygpath -ua . 会得到 /cygdrive/c,因此末尾要有 / @@ -159,23 +156,28 @@ rem 或者添加 export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/ %SystemDrive%\cygwin\bin\bash %thisdir%reinstall.sh %* exit /b - - - - -:download rem bits 要求有 Content-Length 才能下载 +rem cloudflare 的 cdn-cgi/trace 没有 Content-Length rem 据说如果网络设为“按流量计费” bits 也无法下载 rem https://learn.microsoft.com/en-us/windows/win32/bits/http-requirements-for-bits-downloads +rem bitsadmin /transfer "%~3" /priority foreground %~1 %~2 + +:download rem certutil 会被 windows Defender 报毒 rem windows server 2019 要用第二条 certutil 命令 echo Download: %~1 %~2 del /q "%~2" 2>nul if exist "%~2" (echo Cannot delete %~2 & exit /b 1) -if not exist "%~2" certutil -urlcache -f -split "%~1" "%~2" >nul -if not exist "%~2" certutil -urlcache -split "%~1" "%~2" >nul -if not exist "%~2" exit /b 1 -exit /b + +certutil -urlcache -f -split "%~1" "%~2" >nul +if not errorlevel 1 if exist "%~2" exit /b 0 + +certutil -urlcache -split "%~1" "%~2" >nul +if not errorlevel 1 if exist "%~2" exit /b 0 + +rem 下载失败时删除文件,防止下载了一部分导致下次运行时跳过了下载 +del /q "%~2" 2>nul +exit /b 1 :download_with_curl rem 加 --insecure 防止以下错误