1、获取管理员权限:创建新文档,更名为“获取管理员权限.reg”,填入如下内容,保存,双击

    1. Windows Registry Editor Version 5.00
    2. [HKEY_CLASSES_ROOT\*\shell\runas]
    3. @="管理员取得所有权"
    4. "NoWorkingDirectory"=""
    5. [HKEY_CLASSES_ROOT\*\shell\runas\command]
    6. @="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
    7. "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
    8. [HKEY_CLASSES_ROOT\exefile\shell\runas2]
    9. @="管理员取得所有权"
    10. "NoWorkingDirectory"=""
    11. [HKEY_CLASSES_ROOT\exefile\shell\runas2\command]
    12. @="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
    13. "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
    14. [HKEY_CLASSES_ROOT\Directory\shell\runas]
    15. @="管理员取得所有权"
    16. "NoWorkingDirectory"=""
    17. [HKEY_CLASSES_ROOT\Directory\shell\runas\command]
    18. @="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
    19. "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"

    取消管理员权限:

    1. Windows Registry Editor Version 5.00
    2. [-HKEY_CLASSES_ROOT\*\shell\runas]
    3. [-HKEY_CLASSES_ROOT\Directory\shell\runas]
    4. [-HKEY_CLASSES_ROOT\dllfile\shell]
    5. [-HKEY_CLASSES_ROOT\Drive\shell\runas]
    6. [-HKEY_CLASSES_ROOT\exefile\shell\runas]
    7. [HKEY_CLASSES_ROOT\exefile\shell\runas]
    8. "HasLUAShield"=""
    9. [HKEY_CLASSES_ROOT\exefile\shell\runas\command]
    10. @="\"%1\" %*"
    11. "IsolatedCommand"="\"%1\" %*"

    2、恢复原始权限:

    1. Windows Registry Editor Version 5.00
    2. [HKEY_CLASSES_ROOT\*\shell\runas-]
    3. @="恢复原始权限"
    4. "Icon"="C:\\Windows\\System32\\imageres.dll,101"
    5. "NoWorkingDirectory"=""
    6. [HKEY_CLASSES_ROOT\*\shell\runas-\command]
    7. @="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /reset && cacls \"%1\" /e /r \"%%USERNAME%%\""
    8. "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /reset && cacls \"%1\" /e /r \"%%USERNAME%%\""
    9. [HKEY_CLASSES_ROOT\exefile\shell\runas2-]
    10. @="恢复原始权限"
    11. "Icon"="C:\\Windows\\System32\\imageres.dll,101"
    12. "NoWorkingDirectory"=""
    13. [HKEY_CLASSES_ROOT\exefile\shell\runas2-\command]
    14. @="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /reset && cacls \"%1\" /e /r \"%%USERNAME%%\""
    15. "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /reset && cacls \"%1\" /e /r \"%%USERNAME%%\""
    16. [HKEY_CLASSES_ROOT\Directory\shell\runas-]
    17. @="恢复原始权限"
    18. "Icon"="C:\\Windows\\System32\\imageres.dll,101"
    19. "NoWorkingDirectory"=""
    20. [HKEY_CLASSES_ROOT\Directory\shell\runas-\command]
    21. @="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /reset && cacls \"%1\" /e /r \"%%USERNAME%%\""
    22. "IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /reset && cacls \"%1\" /e /r \"%%USERNAME%%\""