Last active
January 20, 2024 02:23
-
-
Save OnCloud125252/14c7067b40c106cb179e0bf78555db2b to your computer and use it in GitHub Desktop.
Run Batch As Administrator
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
TITLE Asking for administrator access | |
MODE CON COLS=37 LINES=3 | |
COLOR F0 | |
ECHO ::::::::::::::::::::::::::::::::::::: | |
ECHO :: Requesting administrator access :: | |
ECHO ::::::::::::::::::::::::::::::::::::: | |
cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || ( cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && ""%~s0"" %Apply%", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B ) | |
COLOR | |
CLS | |
// The following command will be run as administrator |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment