hi-client/copy_libcore.bat
shanshanzhong ad5d0c9b7a
Some checks failed
Build Windows / ACT Windows Checkout Verification (push) Successful in 7h0m18s
Build Windows / 编译 libcore (Windows) (20.15.1) (push) Successful in 19m10s
Build Windows / build (push) Failing after 7h0m29s
fix(copy_libcore.bat): 改进jq安装脚本的可靠性和清理逻辑
将内联的PowerShell命令改为临时脚本文件执行
添加临时文件清理逻辑确保脚本执行后不留残留
2025-11-07 04:10:24 -08:00

78 lines
2.2 KiB
Batchfile
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@echo off
echo 📋 复制 libcore 文件...
:: 创建目标目录
mkdir libcore\bin >nul 2>&1
:: 查找并复制 HiddifyCli.exe重命名为 BearVPNCli.exe
for /r %%f in (HiddifyCli.exe) do (
if exist "%%f" (
echo ✅ 找到 HiddifyCli.exe: %%f
echo 📝 复制并重命名为 BearVPNCli.exe
copy "%%f" libcore\bin\BearVPNCli.exe
echo ✅ 重命名完成
goto :dll
)
)
echo ⚠️ 未找到 HiddifyCli.exe
:dll
:: 复制 libcore.dll
for /r %%f in (libcore.dll) do (
if exist "%%f" (
echo ✅ 找到 libcore.dll: %%f
copy "%%f" libcore\bin\libcore.dll
goto :install_jq
)
)
echo ⚠️ 未找到 libcore.dll
:install_jq
echo 📦 安装 jq...
:: 创建临时 PowerShell 脚本文件
echo if (!(Get-Command choco -ErrorAction SilentlyContinue)) { > install_jq.ps1
echo Set-ExecutionPolicy Bypass -Scope Process -Force; >> install_jq.ps1
echo [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; >> install_jq.ps1
echo iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) >> install_jq.ps1
echo } >> install_jq.ps1
echo choco install jq -y >> install_jq.ps1
echo $env:Path = [System.Environment]::GetEnvironmentVariable('Path','Machine') + ';' + [System.Environment]::GetEnvironmentVariable('Path','User') >> install_jq.ps1
echo jq --version >> install_jq.ps1
:: 执行 PowerShell 脚本
powershell -NoProfile -ExecutionPolicy Bypass -File install_jq.ps1
if %ERRORLEVEL% neq 0 (
echo ❌ jq 安装失败
del install_jq.ps1
exit /b 1
)
:: 清理临时文件
del install_jq.ps1
echo ✅ jq 安装成功
goto :verify
:verify
echo.
echo 📄 验证文件:
if exist libcore\bin (
dir libcore\bin
if exist libcore\bin\BearVPNCli.exe (
if exist libcore\bin\libcore.dll (
echo ✅ 验证成功:所有文件已正确复制
exit /b 0
) else (
echo ❌ 验证失败libcore.dll 不存在
exit /b 1
)
) else (
echo ❌ 验证失败BearVPNCli.exe 不存在
exit /b 1
)
) else (
echo ⚠️ libcore\bin 目录不存在
exit /b 1
)