- UID
- 235022
- 好友
注册时间2013-5-26
威望值 点
最后登录1970-1-1
激情值 点
积分3917
认证分 分
齿轮币 枚
回帖0
|
@echo OFF & CLS & ECHO.
:: BatchGotAdmin
:: https://social.technet.microsoft ... rum=w7itprosecurity
:-------------------------------------
REM --> Check for permissions
NET FILE 1>NUL 2>NUL &
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
pushd "%CD%"
CD /D "%~dp0"
:--------------------------------------
REM ... proceed here with admin rights ...
IF EXIST "%~dp0\opengl32.dll" (
CHOICE /M "Software OpenGL driver is already enabled. Do you want to disable it?"
IF ERRORLEVEL 2 GOTO End
IF ERRORLEVEL 1 (
DEL "%~dp0\opengl32.dll"
IF ERRORLEVEL 1 (
ECHO Failed to disable Software OpenGL driver. Please contact KISSsoft support for assistance.
) ELSE (
ECHO Software OpenGL driver disabled succesfully!
)
)
) ELSE (
COPY "%~dp0\opengl32sw.dll" "%~dp0\opengl32.dll" >nul 2>&1
IF ERRORLEVEL 1 (
ECHO Failed to enable Software OpenGL driver. Please contact KISSsoft support for assistance.
) ELSE (
ECHO Software OpenGL driver enabled succesfully!
)
)
:End
@PAUSE |
|