首页 > 其他分享 >bat获取管理权限

bat获取管理权限

时间:2022-11-08 11:44:33浏览次数:47  
标签:bat goto UACAdmin dp0 echo 管理权限 获取 exit SystemRoot%

 

 

@echo off&color 17
if exist "%SystemRoot%\SysWOW64" path %path%;%windir%\SysNative;%SystemRoot%\SysWOW64;%~dp0
bcdedit >nul
if '%errorlevel%' NEQ '0' (goto UACPrompt) else (goto UACAdmin)
:UACPrompt
%1 start "" mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&exit
exit /B
:UACAdmin
cd /d "%~dp0"
echo 当前运行路径是:%CD%
echo 已获取管理员权限

 

标签:bat,goto,UACAdmin,dp0,echo,管理权限,获取,exit,SystemRoot%
From: https://www.cnblogs.com/ai594ai/p/16869145.html

相关文章