Batch script admin check

Have a batch script that requires administrator elevation? Put this line at the top of your script.


@FLTMC >NUL 2>&1 || (POWERSHELL -WINDOWSTYLE HIDDEN START-PROCESS """%~f0""" -VERB RUNAS & EXIT /B)
This entry was posted in Coding and tagged , . Bookmark the permalink.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.