Skip to content

Instantly share code, notes, and snippets.

@asheroto
Last active June 7, 2021 12:35
Show Gist options
  • Save asheroto/9a1315db552d7f801bc80cc0a83e8ee2 to your computer and use it in GitHub Desktop.
Save asheroto/9a1315db552d7f801bc80cc0a83e8ee2 to your computer and use it in GitHub Desktop.
Confirms if you are running the BAT/CMD script as administrator and prompts you to do so if not.
@echo off
:: Confirm running as administrator
fltmc >nul 2>&1 || (
echo This batch script requires administrator privileges. Right-click on
echo the script and select "Run as Administrator".
goto :die
)
:: Your code starts here
:: Your code ends here
:die
echo.
pause
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment