I wanted to call from batch file powershell script that required administrative privileges.
I needed to check, if it was started as Administrator and also set current directory where the batch is located.
Thanks to couple of stackoverflow questions I've got this batch
@echo off
goto check_Permissions
:process
powershell &:: TODO the script to call
@pause
goto end
:check_Permissions
net session >nul 2>&1
if %errorLevel% == 0 (
@rem echo Success: Administrative permissions confirmed.
goto process
) else (
echo Administrative permissions required.
)
pause >nul
:end