How to check in a batch file if you are running it elevated

Sometimes it is useful to check in a batch file if it was started from an elevated command prompt or as an administrator. I would like to share with you a trick which I am using to do this. The main idea of my trick is based on the value of the special environment variable %errorlevel% which stores the exit code for most console apps and commands. Let's see this in action.
Continue reading "How to check in a batch file if you are running it elevated"

Exit mobile version
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.