Skip to content

Instantly share code, notes, and snippets.

@Terrabits
Created June 22, 2020 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Terrabits/2cd5f423e56a81867e6be36c7f01895c to your computer and use it in GitHub Desktop.
Save Terrabits/2cd5f423e56a81867e6be36c7f01895c to your computer and use it in GitHub Desktop.
asserts that the current environment includes administrator privileges
rem Batch script: how to check for admin rights
rem https://stackoverflow.com/a/11995662/1390788
net session >nul 2>&1
if not %ErrorLevel% == 0 (
echo "ERROR: no administrative priviliges"
exit /b 1
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment