从命令行中删除文件或文件夹或从 Unlocker 等不错的 GUI 工具中删除锁定的文件或文件夹很容易。
但是有没有办法从命令行删除锁定的文件/文件夹?
我正在尝试使用 Sysinternals Handle 软件 ( http://technet.microsoft.com/en-us/sysinternals/bb896655 )在 Windows 中关闭锁定文件的句柄。
首先我搜索打开的句柄:
handle.exe "C:\Temp"
Run Code Online (Sandbox Code Playgroud)
它向我发出以下问题:
Far.exe pid: 1144 类型: 文件 2E8: C:\Temp
Far.exe pid: 1144 类型: 文件 3A8: C:\Temp
接下来我使用 -c 参数运行 handle.exe。但是,无论我输入哪个数字,它都没有任何作用。我已经尝试过:1144、2E8、3A8 和 1144 十六进制(478),因为软件帮助说它接受十六进制的 PID。无论我输入什么,它只会发出以下内容:
Handle v3.46
Copyright (C) 1997-2011 Mark Russinovich
Sysinternals - www.sysinternals.com
usage: handle [[-a [-l]] [-u] | [-c <handle> [-y]] | [-s]] [-p <process>|<pid>] [name]
-a Dump all handle information.
-l Just show pagefile-backed section handles.
-c Closes the specified handle (interpreted as a hexadecimal number). …Run Code Online (Sandbox Code Playgroud)