@echo off
:: Check whether the script is running as an administrator
net session >nul 2>&1
if %errorLevel% neq 0 (
    echo Restart as administrator ...
    powershell.exe -Command "Start-Process cmd -ArgumentList '/c %~s0' -Verb RunAs"
    exit /b
)

:: Script now runs as admin, start PowerShell
pwsh.exe -WindowStyle Maximized -NoExit -ExecutionPolicy Bypass -File "%~dp0..\scripts\Apply-AutostartSettings.ps1"