Last active
March 5, 2022 00:16
-
-
Save albertopasqualetto/32e4c681d10c02c1d1fb638392c7975f to your computer and use it in GitHub Desktop.
batch code to request admin previleges, if no admin previleges
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: 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