Invoking UAC for Privilege Escalation in batch file
@echo off
at >nul
if %errorlevel% == 0 goto run_elevated
 
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%getUACpriv.vbs"
echo UAC.ShellExecute %0, "", "", "runas", 1 >> "%temp%getUACpriv.vbs"
 
ECHO Privilege Escalation
 
"%temp%getUACpriv.vbs" >nul
exit /B
 
:run_elevated
    del "%temp%getUACpriv.vbs" 2>nul    
    CD "%~dp0"
 
REM your commands
 
pause>nul
%d bloggers like this: