


Winaeroに下記の記事がありました
How to check in a batch file if you are running it elevated
http://winaero.com/blog/how-to-check-in-a-batch-file-if-you-are-running-it-elevated/
このサイトはWindows関連の色々な裏ワザやTipsを紹介してくれているので購読しているサイトです
今回の記事はバッチファイルが管理者権限で実行しているかどうかを判断するものです
判断には管理者権限が無いと動作しないコマンドopenfilesを実行してエラーレベルで判断する方法です
バッチファイルのサンプル
| 1 2 3 4 5 6 7 8 9 | @echo off openfiles > NUL 2>&1  if NOT %ERRORLEVEL% EQU 0 goto NotAdmin  echo 管理者権限で実行中 goto End :NotAdmin  echo 一般権限で実行中 :End | 

