Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

Win7 取得檔案/資料夾完整控制權:匯入登錄檔新增右鍵「管理員取得所有權」

編輯:Windows 7 系統介紹

Windows 7 強化權限機制,即使是 Administrator 也常無法刪除系統檔案(如 TrustedInstaller 擁有權)。透過匯入登錄檔,在右鍵選單新增「管理員取得所有權」,即可一鍵取得控制權進行刪除或修改。

適用版本與風險提醒

  • 原版登錄檔適用 Win7 RTM,Win7 SP1 需使用修正版(指令將 & 改為 &&)。
  • 警告:僅對確定安全的檔案/資料夾操作,刪除系統關鍵檔案會導致系統損壞。

Win7 SP1 適用登錄檔內容

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"

使用方法

  1. 將上述內容儲存為 TakeOwnership.reg。
  2. 雙擊匯入登錄表(需管理員權限)。
  3. 對目標檔案/資料夾右鍵 → 選擇「管理員取得所有權」。
  4. 命令提示字元視窗閃過即完成,隨後即可正常刪除、修改。

此技巧對清理 Windows.old、系統備份檔案、頑固殘留資料夾極為實用。

Copyright © Windows教程網 All Rights Reserved