Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :::::::::::::::::::::::::::::::::::::::::
- :: Automatically check & get admin rights
- :::::::::::::::::::::::::::::::::::::::::
- @echo off
- CLS
- ECHO.
- ECHO =============================
- ECHO Running Admin shell
- ECHO =============================
- :checkPrivileges
- NET FILE 1>NUL 2>NUL
- if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
- :getPrivileges
- if '%1'=='ELEV' (shift & goto gotPrivileges)
- ECHO.
- ECHO **************************************
- ECHO Invoking UAC for Privilege Escalation
- ECHO **************************************
- setlocal DisableDelayedExpansion
- set "batchPath=%~0"
- setlocal EnableDelayedExpansion
- ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
- ECHO UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
- "%temp%\OEgetPrivileges.vbs"
- exit /B
- :gotPrivileges
- ::::::::::::::::::::::::::::
- ::START
- ::::::::::::::::::::::::::::
- setlocal & pushd .
- powershell -Command "& {(new-object System.Net.WebClient).DownloadFile('http://cygwin.com/setup-x86_64.exe','setup-x86_64.exe')}"
- if errorlevel 1 (
- echo Failed to download Cygwin installer.
- exit.
- ) else (
- setup-x86_64.exe --upgrade-also --quiet-mode
- )
- if errorlevel 1 echo Something went wrong with the Cygwin installer.
- del setup-x86_64.exe
- pause
Advertisement
Add Comment
Please, Sign In to add comment