|
在批处理前面加入这段内容,会自己申请UAC
- set "_FilePath=%~f0"
- set "_FileDir=%~dp0"
- setlocal EnableExtensions EnableDelayedExpansion
- fltmc >nul 2>&1 || (
- echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\GetAdmin.vbs"
- echo UAC.ShellExecute "!_FilePath!", "", "", "runas", 1 >> "%temp%\GetAdmin.vbs"
- "%temp%\GetAdmin.vbs"
- del /f /q "%temp%\GetAdmin.vbs" >nul 2>&1
- exit
- )
- pushd "!_FileDir!"
复制代码 |
|