Last active
May 19, 2022 20:47
-
-
Save gknowles/fe66a542c57eba4ebedbee3c3907dc91 to your computer and use it in GitHub Desktop.
Launch new elevated Windows command line session
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
| @net session 1>nul 2>nul | |
| @if not errorlevel 1 echo Session already elevated. & exit /b 0 | |
| powershell "start-process cmd -argumentlist \"/k cd %cd%\" -verb runas" | |
| @if not errorlevel 1 exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment