Skip to content

Instantly share code, notes, and snippets.

@albertopasqualetto
Last active March 5, 2022 00:16
Show Gist options
  • Save albertopasqualetto/32e4c681d10c02c1d1fb638392c7975f to your computer and use it in GitHub Desktop.
Save albertopasqualetto/32e4c681d10c02c1d1fb638392c7975f to your computer and use it in GitHub Desktop.
batch code to request admin previleges, if no admin previleges
:: Source: https://stackoverflow.com/questions/1894967/how-to-request-administrator-access-inside-a-batch-file
:: Source: https://stackoverflow.com/questions/4051883/batch-script-how-to-check-for-admin-rights
:: batch code to request admin previleges, if no admin previleges
fltmc >nul 2>&1
if NOT %errorLevel% == 0 (
powershell start -verb runas '%0' am_admin & exit /b
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment