右键添加管理员权限
新建txt文件 将下述代码复制到txt文件 修改txt文件后缀为 .reg 运行 reg 文件 成功
Windows Registry Editor Version 5.00
[ HKEY_CLASSES_ROOT\ *\ shell\ runas]
@= "获取管理员所有权"
"NoWorkingDirectory" = ""
[ HKEY_CLASSES_ROOT\ *\ shell\ runas\ command]
@= "cmd.exe /c takeown /f \" %1\" && icacls \" %1\" /grant administrators:F"
"IsolatedCommand" = "cmd.exe /c takeown /f \" %1\" && icacls \" %1\" /grant administrators:F"
[ HKEY_CLASSES_ROOT\ exefile\ shell\ runas2]
@= "获取管理员所有权"
"NoWorkingDirectory" = ""
[ HKEY_CLASSES_ROOT\ exefile\ shell\ runas2\ command]
@= "cmd.exe /c takeown /f \" %1\" && icacls \" %1\" /grant administrators:F"
"IsolatedCommand" = "cmd.exe /c takeown /f \" %1\" && icacls \" %1\" /grant administrators:F"
[ HKEY_CLASSES_ROOT\ Directory\ shell\ runas]
@= "获取管理员所有权"
"NoWorkingDirectory" = ""
[ HKEY_CLASSES_ROOT\ Directory\ shell\ runas\ command]
@= "cmd.exe /c takeown /f \" %1\" /r /d y && icacls \" %1\" /grant administrators:F /t"
"IsolatedCommand" = "cmd.exe /c takeown /f \" %1\" /r /d y && icacls \" %1\" /grant administrators:F /t"
右键取消管理权权限
新建txt文件 将下述代码复制到txt文件 修改txt文件后缀为 .reg 运行 reg 文件 成功
Windows Registry Editor Version 5.00
[ -HKEY_CLASSES_ROOT\ *\ shell\ runas]
[ -HKEY_CLASSES_ROOT\ exefile\ shell\ runas2]
[ -HKEY_CLASSES_ROOT\ Directory\ shell\ runas]