Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ECHO OFF
- REM Test current admin level
- REG QUERY HKU\S-1-5-19\Environment >NUL 2>&1 && goto :START_PROCESS
- REM Relaunch as admin if above fails
- powershell -NoProfile Start-Process -FilePath '%COMSPEC%' -ArgumentList '/c """%~0"""' -Verb RunAs 2>NUL
- REM Error if re-launching as admin fails
- IF %ERRORLEVEL% GTR 0 (
- echo =====================================================
- echo This script needs to be executed as an administrator.
- echo =====================================================
- echo.
- pause
- )
- goto :EOF
- :START_PROCESS
- REM Put your script here
- :EOF
Add Comment
Please, Sign In to add comment