Files
install-sh/install-bottom.bat
T

70 lines
2.3 KiB
Batchfile

@echo off
:: ============================================================
:: install-bottom.bat
:: Install script for bottom(btm) process monitor (Windows batch)
::
:: This file calls the PowerShell script (install-bottom.ps1).
:: PowerShell 5.1 or higher is required (included in Windows 10/11).
::
:: Usage:
:: install-bottom.bat
:: install-bottom.bat "C:\tools\bin" <- specify install path
:: ============================================================
:: ── Switch to UTF-8 codepage ──
chcp 65001 >nul
setlocal EnableDelayedExpansion
echo [INFO] install-bottom.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-bottom.ps1 in same folder ──
set "PS1_PATH=%~dp0install-bottom.ps1"
if not exist "%PS1_PATH%" (
echo [ERROR] install-bottom.ps1 not found.
echo install-bottom.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 'btm' command.
) else (
echo [ERROR] An error occurred during installation. (Exit code: %PS_EXIT%)
)
echo.
pause
exit /b %PS_EXIT%