70 lines
2.3 KiB
Batchfile
70 lines
2.3 KiB
Batchfile
@echo off
|
|
:: ============================================================
|
|
:: install-lazygit.bat
|
|
:: Install script for lazygit terminal UI for git (Windows batch)
|
|
::
|
|
:: This file calls the PowerShell script (install-lazygit.ps1).
|
|
:: PowerShell 5.1 or higher is required (included in Windows 10/11).
|
|
::
|
|
:: Usage:
|
|
:: install-lazygit.bat
|
|
:: install-lazygit.bat "C:\tools\bin" <- specify install path
|
|
:: ============================================================
|
|
|
|
:: ── Switch to UTF-8 codepage ──
|
|
chcp 65001 >nul
|
|
|
|
setlocal EnableDelayedExpansion
|
|
|
|
echo [INFO] install-lazygit.bat started
|
|
|
|
:: ── Check if PowerShell exists ────────────────────────────────
|
|
where powershell >nul 2>&1
|
|
if %ERRORLEVEL% neq 0 (
|
|
echo [ERROR] PowerShell not found.
|
|
echo PowerShell is included in Windows 7 and later.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
:: ── Check location of install-lazygit.ps1 in same folder ──
|
|
set "PS1_PATH=%~dp0install-lazygit.ps1"
|
|
if not exist "%PS1_PATH%" (
|
|
echo [ERROR] install-lazygit.ps1 not found.
|
|
echo install-lazygit.ps1 must be in the same folder as this batch file.
|
|
echo Location: %PS1_PATH%
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
:: ── Process install path parameter ────────────────────────────────
|
|
set "EXTRA_ARGS="
|
|
if not "%~1"=="" (
|
|
set "EXTRA_ARGS=-InstallDir ""%~1"""
|
|
echo [INFO] Install path specified: %~1
|
|
)
|
|
|
|
echo [INFO] Running PowerShell script...
|
|
echo.
|
|
|
|
:: ── Run PowerShell ─────────────────────────────────────────
|
|
:: -ExecutionPolicy Bypass : Bypass execution policy (no user config change)
|
|
:: -NoProfile : Skip profile loading (faster startup)
|
|
:: -NonInteractive : Suppress interactive prompts
|
|
powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive ^
|
|
-File "%PS1_PATH%" %EXTRA_ARGS%
|
|
|
|
set "PS_EXIT=%ERRORLEVEL%"
|
|
|
|
echo.
|
|
if %PS_EXIT% equ 0 (
|
|
echo [INFO] Installation complete.
|
|
echo Open a new terminal (cmd/PowerShell) to use the 'lazygit' command.
|
|
) else (
|
|
echo [ERROR] An error occurred during installation. (Exit code: %PS_EXIT%)
|
|
)
|
|
|
|
echo.
|
|
pause
|
|
exit /b %PS_EXIT%
|