Check for an elevated command prompt in Batch

Today I was asked to look at a section of a batch script that checked if the command prompt or script was run with elevated permissions.
So I started both a normal and elevated CMD and started testing and scripting.
The solution that was used in the script utilized the WHOAMI command line tool, which is part of the Windows operating system.
However, we found that the script didn’t work on Windows 8 or any later Windows operating system.