hi-client/install_build_tools.bat
shanshanzhong 7956349c0a feat(打包): 添加Windows单文件打包脚本和工具安装脚本
添加install_build_tools.bat用于自动安装构建工具
添加package_windows_single_exe.ps1用于打包Flutter应用为单文件
改进inno_setup.sas增加卸载清理逻辑和进程终止功能
2025-11-24 00:52:28 -08:00

64 lines
2.1 KiB
Batchfile

@echo off
:: This script checks for and installs all necessary tools for building and packaging the Flutter application on Windows.
:: 1. Check for Administrator Privileges
net session >nul 2>&1
if %errorLevel% == 0 (
echo Administrator privileges detected. Continuing...
) else (
echo Requesting Administrator privileges to install tools...
powershell -Command "Start-Process cmd.exe -ArgumentList '/c %~s0' -Verb RunAs" >nul 2>&1
exit /b
)
:: 2. Check for and Install Chocolatey
echo.
echo === Checking for Chocolatey ===
where choco >nul 2>&1
if %errorlevel% equ 0 (
echo Chocolatey is already installed.
) else (
echo Chocolatey not found. Installing now...
powershell -NoProfile -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))"
if %errorlevel% neq 0 (
echo ERROR: Failed to install Chocolatey. Please install it manually from https://chocolatey.org
pause
exit /b 1
)
echo Chocolatey installed successfully.
:: Add Chocolatey to the PATH for the current session
set "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
)
:: 3. Install Required Tools via Chocolatey
echo.
echo === Installing Build Tools (7-Zip and Enigma Virtual Box) ===
:: Install 7-Zip
echo Installing 7-Zip...
choco install 7zip -y
if %errorlevel% neq 0 (
echo ERROR: Failed to install 7-Zip.
pause
exit /b 1
)
echo 7-Zip installed successfully.
:: Install Enigma Virtual Box
echo Installing Enigma Virtual Box...
choco install enigma-virtual-box -y
if %errorlevel% neq 0 (
echo ERROR: Failed to install Enigma Virtual Box.
pause
exit /b 1
)
echo Enigma Virtual Box installed successfully.
echo.
echo =======================================================
echo All required build tools have been installed.
echo You can now use 'package_windows_single_exe.ps1' to build your single-file executable.
echo =======================================================
echo.
pause