如果有人需要一键式解决方案,这是命令行批处理脚本。你需要把SubInACL.exe的文件夹中有脚本(明白了这里从微软)。
@echo off
Setlocal EnableDelayedExpansion
:check_admin
NET FILE 1>NUL 2>NUL
IF ERRORLEVEL 1 (
cls
echo Starting as admin ...
powershell "saps -filepath %0 -verb runas" >nul 2>&1
exit
)
cls
:set_privileges
rem Enable explorer to run privileged, src: https://superuser.com/a/591082/145585
echo Setting permissions ...
rem change owner to Administrators
rem should report: Done: 1, Modified 1, Failed 0, Syntax errors 0
%~dp0subinacl.exe /noverbose /statistic /subkeyreg "HKEY_CLASSES_ROOT\AppID\{CDCBCFCA-3CDC-436f-A4E2-0E02075250C2}" /setowner=administrators >nul 2>nul
rem give Administrators full permission
rem should report: Done: 1, Modified 1, Failed 0, Syntax errors 0
%~dp0subinacl.exe /noverbose /statistic /subkeyreg "HKEY_CLASSES_ROOT\AppID\{CDCBCFCA-3CDC-436f-A4E2-0E02075250C2}" /grant=administrators=f >nul 2>nul
echo Rename registry entry ...
powershell -ExecutionPolicy Bypass -Command "Rename-ItemProperty -Path 'Registry::HKEY_CLASSES_ROOT\AppID\{CDCBCFCA-3CDC-436f-A4E2-0E02075250C2}' -Name 'RunAs' -NewName '_Runas' -ErrorAction SilentlyContinue"
:run_explorer
echo Starting explorer ...
start "" /MAX "c:\windows\explorer.exe" "%~dp0"