Last active
January 8, 2025 20:57
-
-
Save maciakl/f30629d1a606030e55855842447472c5 to your computer and use it in GitHub Desktop.
If your batch file needs to run as Administrator, put this at the top of your script. It will initiate a UAC prompt and run the rest of the script in elevated mode.
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
if "%1" == "elevated" goto start | |
powershell -command "Start-Process %~nx0 elevated -Verb runas" | |
goto :EOF | |
:start | |
rem your code goes here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment