浅谈批处理获取管理员运行权限的几种方法
方法1:借用VBS脚本 %1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit 方法2: 借用 VBS脚本 %1 start "" mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&exit exit /B 方法3: 借用 VBS脚本 echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" "%temp%\getadmin.vbs" del /f /q "%temp%\getadmin.vbs" >nul exit /B 方法4: 借用 第三方程序 nircmd elevate cmd /c "%0" exit /B 方法5:runas命令 runas /noprofile /user