Just a few lines of code in a batch file will check if the batch file is executed with full administrator rights. This is great in eg. Win7 enviroments and when used with superusers who tends to forget :)

 

@ECHO OFF

::Admin check
AT > NUL
IF %ERRORLEVEL% EQU 0 (
    GOTO execute
) ELSE (
    ECHO Script must run as admin, exiting...
    Pause
    EXIT /B 1
)

::Script below

:execute