Is there a way to handle locked file from command line and release it? [closed]

怎甘沉沦 提交于 2019-12-18 14:53:20

问题


Is there a way to detect locked files in specify folder and release them by command line?

Something like this in pseudo-code:

for file in folder do
unlock file

回答1:


Yes, this is possible using a free utility called Handle, by Mark Russinovich.

It can be download here from Microsoft.

This runs from the command line, and will tell you which program has a particular file or directory open, based on whether it has an open handle to that resource.

By running handle.exe with the -c flag, you can also force the specified handle closed, which will unlock the resource. But fair warning: this will likely cause the application using the resource to crash, perhaps even the entire system to become unstable. So I wouldn't make a habit of doing this; only use it for special cases like debugging where you expect some instability.




回答2:


No, you can't you have to close the application holding the lock first. Unlocker may help you locate the source of the lock - if it's a crashed application then you'll be able to terminate it's process.



来源:https://stackoverflow.com/questions/10672166/is-there-a-way-to-handle-locked-file-from-command-line-and-release-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!