@echo off cd /D "%~dp0" echo This script downloads the Beszel repository and builds the Beszel agent for Windows (64 Bit only). echo If not yet installed, Git and Go will be installed via Winget. echo. call env.cmd set REFRESHENV=0 where winget.exe >nul 2>&1 if %errorlevel% NEQ 0 ( echo Winget not found, install Winget or use a compatible OS: Win 10 Client OS or later goto end ) else ( echo Winget executable found ) where go.exe >nul 2>&1 if %errorlevel% NEQ 0 ( echo Installing Go with Winget winget install GoLang.Go --accept-source-agreements --accept-package-agreements >nul 2>&1 set REFRESHENV=1 ) else ( echo Go executable found ) where git.exe >nul 2>&1 if %errorlevel% NEQ 0 ( echo Installing Git with Winget winget install Git.Git --accept-source-agreements --accept-package-agreements >nul 2>&1 set REFRESHENV=1 ) else ( echo Git executable found ) if %REFRESHENV% EQU 1 call .\RefreshEnv.cmd echo Cloning Beszel repository git clone https://github.com/henrygd/beszel.git >nul 2>&1 if %errorlevel% NEQ 0 ( echo Cloning the Beszel repository failed. goto end ) cd .\beszel\beszel\cmd\agent echo Building agent go build -ldflags "-w -s" . >nul 2>&1 if %errorlevel% NEQ 0 ( echo Something went wrong ) else ( echo Build was successful cd /D "%~dp0" copy /y .\beszel\beszel\cmd\agent\agent.exe . >nul 2>&1 echo Beszel agent.exe was built and copied, you can proceed with 'install-beszel-service.cmd'. rd /s/q .\beszel >nul 2>&1 echo Cloned Beszel repository was deleted as we don´t need it anymore. echo. echo You can go ahead with .\install-beszel-service.cmd to install the service. echo . echo If Git ond/or Go was installed from this script and you don´t want to keep them, use echo winget uninstall GoLang.Go echo winget uninstall Git.Git echo to remove the corresponding packages. ) :end