You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.4 KiB
47 lines
1.4 KiB
:::::::::::::::::::::::::::::::::::::::::
|
|
:: Automatically check & get admin rights
|
|
:: Based on http://stackoverflow.com/a/12264592/673826
|
|
:::::::::::::::::::::::::::::::::::::::::
|
|
@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' (echo ELEV & shift /1 & 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 args = "ELEV " >> "%temp%\OEgetPrivileges.vbs"
|
|
ECHO For Each strArg in WScript.Arguments >> "%temp%\OEgetPrivileges.vbs"
|
|
ECHO args = args ^& strArg ^& " " >> "%temp%\OEgetPrivileges.vbs"
|
|
ECHO Next >> "%temp%\OEgetPrivileges.vbs"
|
|
ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
|
|
"%SystemRoot%\System32\WScript.exe" "%temp%\OEgetPrivileges.vbs" %*
|
|
exit /B
|
|
|
|
:gotPrivileges
|
|
if '%1'=='ELEV' shift /1
|
|
setlocal & pushd .
|
|
cd /d %~dp0
|
|
|
|
::::::::::::::::::::::::::::
|
|
::START
|
|
::::::::::::::::::::::::::::
|
|
|
|
rem Run me as Administrator
|
|
set SCRIPT=git-latexdiff
|
|
for /f "delims=" %%i in ('git --exec-path') do copy /Y %~dp0\%SCRIPT% "%%i\%SCRIPT%"
|
|
pause 0
|