Files
vendoo/setup.bat
T

48 lines
1.5 KiB
Batchfile

@echo off
setlocal EnableExtensions
chcp 65001 >nul
title Vendoo Setup
cd /d "%~dp0"
if not exist "%~dp0setup.ps1" (
echo.
echo [FEHLER] setup.ps1 wurde nicht gefunden:
echo %~dp0setup.ps1
echo.
pause
exit /b 2
)
set "VENDOO_SETUP_PS1=%~dp0setup.ps1"
set "VENDOO_SETUP_GUI=%~dp0setup-gui.ps1"
powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "$files=@($env:VENDOO_SETUP_PS1); if(Test-Path -LiteralPath $env:VENDOO_SETUP_GUI){$files += $env:VENDOO_SETUP_GUI}; foreach($file in $files){$tokens=$null; $errors=$null; [System.Management.Automation.Language.Parser]::ParseFile($file,[ref]$tokens,[ref]$errors) | Out-Null; if($errors.Count -gt 0){$errors | ForEach-Object { Write-Host ('[PARSER] ' + $file + ': ' + $_.Message) -ForegroundColor Red }; exit 12}}"
if errorlevel 1 (
echo.
echo [FEHLER] Die PowerShell-Syntax des Installers ist ungueltig.
echo Vendoo Setup wurde aus Sicherheitsgruenden nicht gestartet.
echo.
pause
exit /b 12
)
if "%~1"=="" (
if exist "%VENDOO_SETUP_GUI%" (
powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -STA -File "%VENDOO_SETUP_GUI%"
exit /b %ERRORLEVEL%
)
)
powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File "%VENDOO_SETUP_PS1%" %*
set "VENDOO_EXIT=%ERRORLEVEL%"
if not "%VENDOO_EXIT%"=="0" (
echo.
echo [FEHLER] Vendoo Setup wurde mit Exit-Code %VENDOO_EXIT% beendet.
echo Die Protokolle befinden sich im Ordner "%~dp0logs".
echo.
)
pause
exit /b %VENDOO_EXIT%