From inside a batch file, I would like to test whether I\'m running with Administrator/elevated privileges.
The username doesn\'t change when \"Run as Administrator\
Pretty much what others have put before, but as a one liner that can be put at the beginning of a batch command. (Well, usually after @echo off.)
net.exe session 1>NUL 2>NUL || (Echo This script requires elevated rights. & Exit /b 1)