通过注册表强制解锁文件占用

不飞则已,一飞冲天;不鸣则已,一鸣惊人。这篇文章主要讲述通过注册表强制解锁文件占用相关的知识,希望能为你提供帮助。
【通过注册表强制解锁文件占用】将下面的文本保存为 xxx.reg 并运行一下,添加注册表项目。

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\\*\\shell\\takeownership]
@="Take ownership"
"HasLUAShield"=""
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\\*\\shell\\takeownership\\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\\takeownership]
@="Take ownership"
"HasLUAShield"=""
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\\exefile\\shell\\takeownership\\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\\dllfile\\shell\\takeownership]
@="Take ownership"
"HasLUAShield"=""
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\\dllfile\\shell\\takeownership\\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\\takeownership]
@="Take ownership"
"HasLUAShield"=""
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\\Directory\\shell\\takeownership\\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"

需要删除时只需要右键选择Take Overship
当你要删除一个文件而遇到“无法删除需要权限”的提示时,只要对着文件按下右键,选择『Take ownership』再删除文件即可。





    推荐阅读