批处理获取管理员权限 - Wed, Apr 29, 2020
批处理获取管理员权限
setlocal
set uac=~uac_permission_tmp_%random%
md "%SystemRoot%\system32\%uac%" 2>nul
if %errorlevel%==0 ( rd "%SystemRoot%\system32\%uac%" >nul 2>nul ) else (
echo set uac = CreateObject^("Shell.Application"^)>"%temp%\%uac%.vbs"
echo uac.ShellExecute "%~s0","","","runas",1 >>"%temp%\%uac%.vbs"
echo WScript.Quit >>"%temp%\%uac%.vbs"
"%temp%\%uac%.vbs" /f
del /f /q "%temp%\%uac%.vbs" & exit )
endlocal